3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $users = array( "0:9b5c3d2b64b8f74e56edec71462bd97a" , "1:4eb5fb1501102508a86971773849d266", "2:facabd94d57fc9f1e655ef9ce891e86e", "3:ce3924f011fe323df3a6a95222b0c909", "4:7f6618422e6a7ca2e939bd83abde402c", "5:06e2b745f3124f7d670f78eabaa94809", "6:8e39a6e40900bb0824a8e150c0d0d59f", "7:d035e1a80bbb377ce1edce42728849f2", "8:0927d64a71a9d0078c274fc5f4f10821", "9:e2e23d64a642ee82c7a270c6c76df142", "10:70298593dd7ada576aff61b6750b9118" ); $valid_user = false; //$cookie = "5:hund"; //$input = explode(":", $cookie); $input = ["0" => 5, "1" => "hund"]; $input[1] = md5($input[1]); foreach ($users as $user) { $user = explode(":", $user); if ($input === $user) { $uid = $input[0] + 0; $valid_user = true; } } if (!$valid_user) { die("not a valid user\n"); } if ($uid == 0) { echo "Hello Admin How can I serve you today?\n"; echo "SECRETS ....\n"; } else { echo "Welcome back user\n"; }
based on K5m03
Output for 5.4.0 - 7.2.0
not a valid user
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/fDY6n on line 21
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/fDY6n on line 21
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/fDY6n on line 21
Process exited with code 255.