3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regex = "~%(?:(\d+)[$])?[-+]?(?:[ 0]|['].)?(?:[-]?\d+)?(?:[.]\d+)?[%bcdeEufFgGosxX]~"; $format = 'The %2$s contains %1$d monkeys'; $arguments = array(5, 'tree'); if (preg_match_all($regex, $format, $expected) > 0) { print_r($expected); }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => %2$s [1] => %1$d ) [1] => Array ( [0] => 2 [1] => 1 ) )