3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arrayOfString = array( [0]=>'customer service[-3] technical support[-3]', [1]=>'picture quality[+2]feature[+2]', [2]=>'smell[-2]', [3]=>'player[+2]', [4]=>'player[-3][u]', [5]=>'dvd player[-2]', [6]=>'player[+2][p]', [7]=>'format[+2][u]progressive scan[-2]' ); preg_match_all("/([\w ]+[^[]]*)\[([+-]\d*?)\]/", print_r($arrayOfString, true), $matches); print_r($matches);
Output for 5.4.0 - 5.6.28
Warning: Illegal offset type in /in/G4Xgo on line 3 Warning: Illegal offset type in /in/G4Xgo on line 4 Warning: Illegal offset type in /in/G4Xgo on line 5 Warning: Illegal offset type in /in/G4Xgo on line 6 Warning: Illegal offset type in /in/G4Xgo on line 7 Warning: Illegal offset type in /in/G4Xgo on line 8 Warning: Illegal offset type in /in/G4Xgo on line 9 Warning: Illegal offset type in /in/G4Xgo on line 11 Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected '[', expecting ')' in /in/G4Xgo on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ')' in /in/G4Xgo on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/G4Xgo on line 3
Process exited with code 255.