This is an actual skype conversation from earlier today (edited the names out). please take this knowledge and run with it friends. btw, we are still running php 4.2
[colleague] $testArray = array("index"=>"value");
if(isset($testArray["index"]["crap"]) && !empty($testArray["index"]["crap"])) {
echo "true [{$testArray["index"]["crap"]}]\n";
} else {
echo "false";
}
[colleague] returns true
[me]
php > $test = "value";
php > echo $test["crap"];
v
[me] hehe because value is an array
php > echo (int)"crap";
0
php > echo $test[(string)"crap"];
v
[me] haha
[me] php > $test = array("index"=>"value");
php > echo array_key_exists("crap", $test);
[me] there you go
[me] array_key_exists is ftw
[–]warmans 26 points27 points28 points ago*
[–]d4v1d04 15 points16 points17 points ago
[–]thelerk[S] 2 points3 points4 points ago
[–]Samus_ 3 points4 points5 points ago
[–]HaywoodMullendore -2 points-1 points0 points ago
[–]jous 4 points5 points6 points ago*
[–]uxp 5 points6 points7 points ago
[–]warmans 0 points1 point2 points ago
[–]thelerk[S] -1 points0 points1 point ago
[–]judgej2 2 points3 points4 points ago
[–]ChiperSoft 0 points1 point2 points ago
[–]nikic 8 points9 points10 points ago
[–]BornInTheCCCP 0 points1 point2 points ago
[–]thelerk[S] -3 points-2 points-1 points ago
[–]wvenable 2 points3 points4 points ago
[–]grobolom 1 point2 points3 points ago
[–]skwigger 3 points4 points5 points ago
[–]BTMPL 4 points5 points6 points ago
[–]stonedoubt 0 points1 point2 points ago
[–]dahlma 1 point2 points3 points ago
[–]ChiperSoft -1 points0 points1 point ago
[–]k3n 2 points3 points4 points ago
[–]steelaz 2 points3 points4 points ago*
[–]ChiperSoft 0 points1 point2 points ago
[–]famousmadphilosopher 0 points1 point2 points ago