PHP Syntax For Beginners Cheat Sheet: by Via
PHP Syntax For Beginners Cheat Sheet: by Via
PHP Syntax For Beginners Cheat Sheet: by Via
the server for ($i = 0; $i < 5; ++$i) { Push into $myArray[] = "Something";
if ($i == 2)
is_numeric() test to see if a value Push to $myArray['key'] = "Value";
continue;
is number associative
print "$i , ";
exit() causes script to stop } Create numeric $myArray = array('value',
immediately 'value2');
produces the following output:
trim($string) trims leading and Create $a = array('key'=>'val');
0,1,3,4
trailing spaces associative
implode(', " $string) make array into ... Numeric arrays Keys are numbers:
string break; 0,1,2,3,4
default:
substr ($string, start, grabs a substring
...
len)
}
preg_match('regex', matches regular
$string) expressions can be used with numbers, or strings