3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data= Array ( [1] => Array ( ['A'] => 'reference', ['B'] => 'dob', ['C'] => ''), [2] => Array ( ['A'] => 'SMI13', ['B'] => '03/12/1940', ['C'] => '')); foreach($data as $k=>$v){ foreach($v as $key =>$val){ if (preg_match("/^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8])\/((19|[2-9]\d)\d{2}))|(02\/29\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/",$val)) { echo "match!"; preg_replace("/^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8])\/((19|[2-9]\d)\d{2}))|(02\/29\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/", "/^((((19|[2-9]\d)\d{2})\/(0[13578]|1[02])\/(0[1-9]|[12]\d|3[01]))|(((19|[2-9]\d)\d{2})\/(0[13456789]|1[012])\/(0[1-9]|[12]\d|30))|(((19|[2-9]\d)\d{2})\/02\/(0[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))\/02\/29))$/",$val); } } } print_r($v) .'<br>';
Output for 7.1.4 - 7.1.22, 7.2.0 - 7.2.10
Fatal error: Illegal offset type in /in/ZEW1t on line 4
Process exited with code 255.
Output for 7.1.0 - 7.1.3
Fatal error: Illegal offset type in /in/ZEW1t on line 5
Process exited with code 255.
Output for 5.6.38
Warning: Illegal offset type in /in/ZEW1t on line 5 Warning: Illegal offset type in /in/ZEW1t on line 5 Warning: Illegal offset type in /in/ZEW1t on line 5 Warning: Illegal offset type in /in/ZEW1t on line 5 Warning: Illegal offset type in /in/ZEW1t on line 7 Warning: Illegal offset type in /in/ZEW1t on line 7 Warning: Illegal offset type in /in/ZEW1t on line 7 Warning: Illegal offset type in /in/ZEW1t on line 7 Notice: Undefined variable: v in /in/ZEW1t on line 26

preferences:
177.94 ms | 1395 KiB | 42 Q