3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj = new \StdClass; $obj->textfield->id = 'text12'; $obj->textfield->text = 'herro'; $anotherObj = new \StdClass; $anotherObj->textfield->id = 'text1'; $anotherObj->textfield->text = 'moarrr text'; $yesAnother = new \StdClass; $yesAnother->textfield->id = 'text11'; $yesAnother->textfield->text = 'omggggg'; $array = array($obj, $anotherObj, $yesAnother); foreach($array as $obj) { preg_match_all('#\d+#', $obj->textfield->id, $matches); var_dump($matches[0][0]); }
based on 4qHtg
Output for 5.4.0 - 7.1.0
Warning: Creating default object from empty value in /in/O0da1 on line 4 Warning: Creating default object from empty value in /in/O0da1 on line 8 Warning: Creating default object from empty value in /in/O0da1 on line 12 string(2) "12" string(1) "1" string(2) "11"
Output for 5.3.0 - 5.3.29
Strict Standards: Creating default object from empty value in /in/O0da1 on line 4 Strict Standards: Creating default object from empty value in /in/O0da1 on line 8 Strict Standards: Creating default object from empty value in /in/O0da1 on line 12 string(2) "12" string(1) "1" string(2) "11"
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 11 Strict Standards: Creating default object from empty value in /in/O0da1 on line 4 Strict Standards: Creating default object from empty value in /in/O0da1 on line 8 Strict Standards: Creating default object from empty value in /in/O0da1 on line 12 string(2) "12" string(1) "1" string(2) "11"
Output for 4.3.0 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/O0da1 on line 11 string(2) "12" string(1) "1" string(2) "11"