<?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*?)\]/", implode("," $arrayOfString), $matches);
print_r($matches);
- Output for 5.4.0 - 5.4.24
- Parse error: syntax error, unexpected '$arrayOfString' (T_VARIABLE) in /in/3T6qi on line 13
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected '[', expecting ')' in /in/3T6qi on line 3
Process exited with code 255.
preferences:
172.39 ms | 1399 KiB | 61 Q