3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $comentario = 'message = "El nombre no puede estar vacĂ­o"'; preg_match_all( '/Assert\\\(?P<nombre>\w+)\s*=(.+)\s*/m', $comentario, $assert ); //preg_match_all( '/Assert\\\(?P<nombre>\w+)\((?P<parametros>\w+)\)\s*/m', $comentario, $assert ); //var_dump($assert); var_dump($assert); foreach($assert['nombre'] as $indice => $valor) { if ($valor == 'NotBlank') { $restricciones[$nombre]['Requerido'] = $assert[2][$indice]; } } var_dump($restricciones);
based on MabCf
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(4) { [0]=> array(0) { } ["nombre"]=> array(0) { } [1]=> array(0) { } [2]=> array(0) { } } Notice: Undefined variable: restricciones in /in/DElvU on line 13 NULL
Output for 4.3.3 - 5.0.3
array(4) { [0]=> array(0) { } ["nombre"]=> array(0) { } [1]=> array(0) { } [2]=> array(0) { } } Notice: Undefined variable: restricciones in /in/DElvU on line 13 NULL
Output for 4.3.0 - 4.3.2
array(3) { [0]=> array(0) { } [1]=> array(0) { } [2]=> array(0) { } } Warning: Invalid argument supplied for foreach() in /in/DElvU on line 8 Notice: Undefined variable: restricciones in /in/DElvU on line 13 NULL