3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $models = array( 'Ford F-150' => 0, 'Ford F-150 flärp' => 0, 'Mazda Miata-15' => 1, 'Mazda Miata -15' => 1, 'Mazda Miata-15 dsöfljk' => 1, 'Mazda Miata -15 sdfölkj' => 1 ); $regdate = "15"; $regex = "/\-".$regdate."\b/"; foreach ($models as $model => $expected) { $match = preg_match($regex, $model); echo "$model: " . ($match !== expected) ? "FAIL!" : "pass"; }
Output for 7.2.0
Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL! Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL! Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL! Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL! Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL! Warning: Use of undefined constant expected - assumed 'expected' (this will throw an Error in a future version of PHP) in /in/tMidZ on line 17 FAIL!
Output for 5.3.18 - 7.1.10
Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL! Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL! Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL! Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL! Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL! Notice: Use of undefined constant expected - assumed 'expected' in /in/tMidZ on line 17 FAIL!