3v4l.org

run code in 300+ PHP versions simultaneously
<?php $htmls[] = <<<HTML DATA.tracking.user = { age: "19", name: "John doe", int: 55 } // This works HTML; $htmls[] = <<<HTML DATA.tracking.user = { age: "20", name: "Jane Doe", int: 49 } // This does not works HTML; foreach ($htmls as $html) { var_export(preg_match_all('~(?:\G(?!^),|DATA\.tracking\.user = \{)\s+([^:]+): (\d+|"[^"]*")~', $html, $out, PREG_SET_ORDER) ? $out : []); echo "\n --- \n"; }
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
array ( 0 => array ( 0 => 'DATA.tracking.user = { age: "19"', 1 => 'age', 2 => '"19"', ), 1 => array ( 0 => ', name: "John doe"', 1 => 'name', 2 => '"John doe"', ), 2 => array ( 0 => ', int: 55', 1 => 'int', 2 => '55', ), ) --- array ( 0 => array ( 0 => 'DATA.tracking.user = { age: "20"', 1 => 'age', 2 => '"20"', ), 1 => array ( 0 => ', name: "Jane Doe"', 1 => 'name', 2 => '"Jane Doe"', ), 2 => array ( 0 => ', int: 49', 1 => 'int', 2 => '49', ), ) ---

preferences:
77.04 ms | 409 KiB | 5 Q