Ben "Smarty foreach" tavırlarını çoğaltmak istiyoruz.
Tpl dosya içeriği ($ tplContent) olduğunu:
{foreach from=$tabMethodTest item=entry}
    /**
     * @todo Implement test{$entry.name}().
     */
    public function test{$entry.name}() {
        $this->markTestIncomplete("This test has not been implemented yet.");
    }
{/foreach}
Preg_match_all kodu:
preg_match_all("/(.*)\{foreach(.*)\}(.*)\{\/foreach\}(.*)/im",$tplContent,$regsTplResult);
print_r($regsTplResult);
Print_r dönüş:
Array
(
    [0] => Array
        (
        )
    [1] => Array
        (
        )
    [2] => Array
        (
        )
    [3] => Array
        (
        )
    [4] => Array
        (
        )
)
Nasıl {foreach} {/ foreach} arasındaki kodu döndürebilir?
 
			