Last active
August 29, 2015 14:06
-
-
Save BillKeenan/ed3aeb38293399e09692 to your computer and use it in GitHub Desktop.
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 | |
$notavector =['one','two','three']; | |
print_r($notavector); | |
unset($notavector[1]); | |
//missing a key! | |
print_r($notavector); | |
//so now this will blow up | |
for ($i=0;$i<count($notavector);$i++){ | |
print($notavector[$i]."\r\n"); | |
} | |
/* | |
and now the output: | |
Array | |
( | |
[0] => one | |
[1] => two | |
[2] => three | |
) | |
Array | |
( | |
[0] => one | |
[2] => three | |
) | |
one | |
PHP Notice: Undefined offset: 1 in /private/tmp/proc.php on line 14 | |
Notice: Undefined offset: 1 in /private/tmp/proc.php on line 14 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment