3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lines = [ "1849781487", "1838433023", "1855575775", "1825054296", "1868575843", "1800003509", "1781354776", "1650813649", "1762706044", "1688111114", "1669462381", "1632164916" ]; $searchword = '18'; $matches = array(); foreach($lines as $k=>$v) { if (substr( $v, 0, 2 ) === $searchword) { $matches[$k] = $v; } } print_r($matches);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [0] => 1849781487 [1] => 1838433023 [2] => 1855575775 [3] => 1825054296 [4] => 1868575843 [5] => 1800003509 )

preferences:
96.42 ms | 1555 KiB | 4 Q