fork(5) download
  1. <?php
  2. $search = '358545454554';
  3. $countries = [[1, 'USA'], [93, 'Afghanistan'], [358, 'Finland']];
  4. $country = null;
  5. foreach ($countries as $c) {
  6. if (substr($search, 0, strlen($c[0])) == $c[0]) {
  7. $country = $c[1];
  8. break;
  9. }
  10. }
  11. echo ($country === null) ? 'No country found!' : $country;
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Finland