Skip to content

Instantly share code, notes, and snippets.

@reinislejnieks
Created June 6, 2012 07:55
Show Gist options
  • Save reinislejnieks/2880532 to your computer and use it in GitHub Desktop.
Save reinislejnieks/2880532 to your computer and use it in GitHub Desktop.
PHP - Arrays
<?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