- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?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]);
}