Mega Code Archive

 
Categories / Php / Strings
 

Some string examples

<?php     $str = "This is a string";     $str = $str . " with some more text";     $str .= " and a newline at the end.\n";     $num = 9;     $str = "<p>Number: $num</p>";     $num = 9;     $str = '<p>Number: $num</p>';     $str = 'This is a test.';     $first = $str[0];          $str = 'This is still a test.';     $last = $str[strlen($str)-1]; ?>