[thelist] PHP regex script returns empty array

Jack Timmons jorachim at gmail.com
Sat Apr 11 07:52:57 CDT 2009

On Sat, Apr 11, 2009 at 7:32 AM, Madhu Menon <chef at shiokfood.com> wrote:

> Jack Timmons wrote:
> > In short, preg_match_all returns a multi-dimensional array.

> Yes, but the echo statement part of the foreach function in my code
> sample isn't outputting the array contents, which is the problem I stated.

Multi-dimensional array = when you run a for loop, each iteration return the
next child array.
Next, the foreach of $results returns $results[0] which, as stated, is an
[array] of matches.

Therefore, Symeon's suggestion would make results = an array of strings that
matched your pattern.

On that note, a Linux lol.


Pleasant coding.

-Jack Timmons
Twitter: @codeacula

More information about the thelist mailing list