Created
June 6, 2012 07:55
-
-
Save reinislejnieks/2880532 to your computer and use it in GitHub Desktop.
PHP - Arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array('key' => 'value', 'key' => $value); | |
$arr2 = array(array('key' => 'value', 'key'),array('key' => 'value', 'key' => ''),array('key' => 'value', 'key')); | |
$arr3 = array('key' => array('one' => 'two', 'three' => 'four'), array('foo' => 'bar', 'condition' => false)); | |
$arr4 = array(); | |
$arr4[] = 'key' => 'value', 'foo' => 'bar'; | |
$arr4[] = array('foo' => 'bar', 'one' => 'two'); | |
// Useful Array Functions | |
print_r($arr1); // prints array | |
count($arr2); // count the elements of array | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment