diff --git a/languages/php.php b/languages/php.php index 4c8d311..78a565f 100644 --- a/languages/php.php +++ b/languages/php.php @@ -1,5 +1,75 @@ $value) { + $key = $key; + $value = $value; +} + +// For +for($i = 0; $i < count($arr) - 1; $i++) { + $key = $i; + $value = $arr[$i]; +} + +// While +$i = 0; +while($i < count($arr) - 1) { + $key = $i; + $value = $arr[$i]; +} + +// Do while +$i = 0; +do { + $key = $i; + $value = $arr[$i]; +} while($i < count($arr)); + +// Switch +switch($arr) { + case 1: + break; + case 2: + break; + case 3: + break; + default: +} + +/** + * Global variables + * http://php.net/manual/en/language.variables.superglobals.php + */ +$_SERVER; // SERVER variables +$_GET; // Query params +$_POST; // Post fields +$_REQUEST; // GET and POST together +$GLOBALS; // Array of global variables +$_SESSION; // Browser session +$_FILES; // Array of files that are sent in request +$_COOKIE; // Array of cookies sent in request +$_ENV; // php.ini options +$argv; // Array of terminal arguments (filename included) +$argc; // Number of arguments passed into terminal + /** * Class * http://php.net/manual/en/language.oop5.basic.php