Created
June 2, 2014 11:23
-
-
Save sandisk/51f1eff40e3862970ded to your computer and use it in GitHub Desktop.
Array wat
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 | |
$selected = (array)json_decode('{"1":"2","2":"4","3":"7"}'); | |
var_dump($selected); | |
// array (size=3) | |
// '1' => string '2' (length=1) | |
// '2' => string '4' (length=1) | |
// '3' => string '7' (length=1) | |
var_dump(in_array('1', array_keys($selected))); | |
// true | |
var_dump(array_key_exists('1', $selected)); | |
// false | |
var_dump(isset($selected['1'])); | |
// false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment