<?php $strings = ["form.input|type()","form.input|type('text')","form.input|type('text', {'width': '100px', 'height': '50px'})", "form.input|type('image', {'path': '/path/to/image'})']"]; $regex = '~\(([^()]+)\)~'; foreach ($strings as $string) { if (preg_match($regex, $string, $match)) { list($key, $value) = explode(", ", $match[1], 1); echo $key, $value . "\n"; }}?>
Standard input is empty
'text' 'text', {'width': '100px', 'height': '50px'} 'image', {'path': '/path/to/image'}
PHP Notice: Undefined offset: 1 in /home/pLV4IW/prog.php on line 9 PHP Notice: Undefined offset: 1 in /home/pLV4IW/prog.php on line 9 PHP Notice: Undefined offset: 1 in /home/pLV4IW/prog.php on line 9
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!