my_string=”Welcome to MySite.com” Response.Write ( my_string ) Response.Write “Length of this string = ” & len(my_string) Response.Write “Number of bytes Required for this string = ” & lenB(my_string) The output of this will also show the number of bytes required. Here in this case it will print this: Welcome to MySite.com Length of this string […]
Month: May 2007
PHP: Expressions and Operators
Arithmetic Operators: + Addition Add two values – Subtraction Subtract the second value from the first * Multiplication Multiply two values / Division Divide the first value by the second % Modulus Divide the first value by the second and return only the remainder (for example, 7 % 5 yields 2) Comparison Operators: = = […]
SELECT left(item_num, 4) FROM flowers; If item_num = 754861 then the output will be: 7548 SELECT right(item_num, 4) FROM flowers; If item_num = 754861 then the output will be: 4861
eregi_replace() vs. ereg_replace()
Code: <?php $s = “Coding PHP is fun.”; print “ereg_replace(): ” . ereg_replace(“CODING”, “Learning”, $s) . “<br>”; print “eregi_replace(): ” . eregi_replace(“CODING”, “Learning”, $s); ?> Output: ereg_replace(): Coding PHP is fun. eregi_replace(): Learning PHP is fun. Explanation: eregi_replace() is case insensitive, while ereg_replace() is not.
HTML Special Characters
– – – en dash — — — em dash ¡ ¡ ¡ inverted exclamation ¿ ¿ ¿ inverted question mark " " " quotation mark “ “ “ left double curly quote ” ” ” right double curly quote ' ' apostrophe (single quote) ‘ ‘ ‘ left single curly quote ’ ’ […]
Formatting money / currency using PHP
$formatted = number_format($number,2);