3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(preg_match('#[^0-9./]#','/123l/')); if(!preg_match('#[^0-9./]#','/123l/')) { echo "Value is numeric \n"; } else { echo "Value not numeric \n"; } $plate_number = '1234/5474'; preg_match_all('#[0-9]#',$plate_number,$new_plate_number); var_dump($new_plate_number); var_dump(implode('',$new_plate_number[0])); $arr = explode('1',$plate_number); var_dump($arr);
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
int(1) Value not numeric array(1) { [0]=> array(8) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" [3]=> string(1) "4" [4]=> string(1) "5" [5]=> string(1) "4" [6]=> string(1) "7" [7]=> string(1) "4" } } string(8) "12345474" array(2) { [0]=> string(0) "" [1]=> string(8) "234/5474" }

preferences:
54.27 ms | 407 KiB | 5 Q