3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'blah' => 'reference', ], [ 'A' => 'SMI13', 'B' => '03/12/1940', 'C' => '', ] ]; foreach($data as &$record){ foreach($record as $key => $val){ //you might want to consider using preg_replace_callback instead: 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! $val \n"; $record [$key] = date("Y-m-d", strtotime($val)); } } } unset($record); var_dump($data);
Output for git.master, git.master_jit, rfc.property-hooks
match! 03/12/1940 array(2) { [0]=> array(1) { ["blah"]=> string(9) "reference" } [1]=> array(3) { ["A"]=> string(5) "SMI13" ["B"]=> string(10) "1940-03-12" ["C"]=> string(0) "" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.67 ms | 401 KiB | 8 Q