3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "days=Mon&days=Wed" . "&fruit[1]=Apple&fruit[]=Banana&amp;age=13"; parse_str($str, $output); // gettype will return 'array' or 'string' echo gettype($output['days']); echo ' - '; // array_search will return the key // where the first argument is located echo array_search('Banana', $output['fruit']); echo ' - '; echo array_key_exists('age', $output) ? $output['age'] : 0; ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string - 2 - 0