fork(2) download
  1. <?php
  2. $string = '{[John][16 years old][New York]}{[Michael][22 years old][Las Vegas]}{[Smith][32 years old][Chicago]}';
  3. preg_match_all('/\[(.*?)\]/', $string , $matches, PREG_PATTERN_ORDER);
  4. print_r($matches[1]);
  5.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => John
    [1] => 16 years old
    [2] => New York
    [3] => Michael
    [4] => 22 years old
    [5] => Las Vegas
    [6] => Smith
    [7] => 32 years old
    [8] => Chicago
)