|
home—lects—exams—hws
breeze (snow day)
From PHP Visual Quickstart Guide by Larry Ullman
Based on notes by Jack Davis (jcdavis@radford.edu)
$s1 = "hello"; $s2 = "world"; $s3 = $s1 . $s2; // "helloworld" |
$n1 =44; $s1 = "age"; $newstr = $s1 . $n1; // (coerces number to string) |
nl2br("abc\ndef\nghi"); // returns "abc<br />def<br />ghi" |
$inp = "John Smith"; $first = strtok($inp, ' '); # returns "John" |
$inp = "Radford"; $newinp = substr($inp,0,5); # starting position, length (Radfo) |
$str = "abcdef"; $len = strlen($str); # returns 6 |
$str = "abc"; echo strcmp($str,"xyz"); # returns a negative number |
$name = "Larry E. Ullman"; $newname = str_ireplace('E.','Edward',$name); # Larry Edward Ullman |
home—lects—exams—hws
breeze (snow day)
©2010, Ian Barland, Radford University Last modified 2011.Feb.20 (Sun) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |