...

View Full Version : how to stop print array([0] => preg match



tau9
03-11-2009, 10:56 AM
Hi,

I have used preg match all function and the data that I want is outputted
but when it starts with:

Array ([0]=>

....................................
....................................data

How can I hide the array ([0]=> so only the data shows and doesnt print the
Array([0]=>

I am using print_r($matches[1]);

to print the data.

Any ideas

thanks in advance

Fou-Lu
03-11-2009, 11:13 AM
Preg_match_all has the behaviour of returning a multi-dimensional array. You shouldn't use print_r on it, instead you should extract the matches you're looking for and index into it appropriately.
In the case you have above, you'd use print $matches[1][0];. You can put it in a loop if you want to retrieve all the records from $matches[1] or $matches[0].



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum