fork download
  1. <?php
  2. // Convert into a proper PHP array by trimming the extra stuff and exploding:
  3. $var = '["continent"]["country"]["province"]';
  4. $var = trim($var, '["');
  5. $var = explode('"]["', $var);
  6. // Apply native array functions...
  7. $key = "country";
  8. if (in_array($key, $var))
  9. // Do something if present
  10. echo "Present";
  11. else
  12. echo "Not Present";
  13. ?>
  14.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Present