- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- max: documentation ( source)
<?php
$regex = "~%(?:(\d+)[$])?[-+]?(?:[ 0]|['].)?(?:[-]?\d+)?(?:[.]\d+)?[%bcdeEufFgGosxX]~";
$format = 'The %s contains %d monkeys';
$arguments = array(5, 'tree');
if (preg_match_all($regex, $format, $expected) > 0)
{
print_r(max($expected[1]));
}