Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,21 @@
$array = array();
$array = []; // Simpler form of array initialization
$array['foo'] = 'bar';
$array['bar'] = 'foo';
echo($array['foo']); // bar
echo($array['moo']); // Undefined index
// Alternative (inline) way
$array2 = array('fruit' => 'apple',
'price' => 12.96,
'colour' => 'green');
// Another alternative (simpler) way
$array2 = ['fruit' => 'apple',
'price' => 12.96,
'colour' => 'green'];
// Check if key exists in the associative array
echo(isset($array['foo'])); // Faster, but returns false if the value of the element is set to null
echo(array_key_exists('foo', $array)); // Slower, but returns true if the value of the element is null

View file

@ -0,0 +1,4 @@
foreach($array as $key => $value)
{
echo "Key: $key Value: $value";
}