3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $numbers = ["12345", "12346", "12347", "12398"]; $input = "12498"; $arr = preg_grep("/". substr($input,0,3) . "/", $numbers); Var_dump($arr);
based on Of68M
Output for 5.6.38 - 7.3.0rc3
array(0) { }