Monday, 26 August 2013

How to get values of an array in php

How to get values of an array in php

Im trying to get the hashtagged value seperateley. i gets stored in an
array . i cant seem to extract the value
$string = 'Hi #my name #is #batman';
preg_match_all('/#([\p{L}\p{Mn}]+)/u',$string,$matches);
print_r($matches);
that prints phpArray ( [0] => Array ( [0] => #my [1] => #is [2] => #batman
) [1] => Array ( [0] => my [1] => is [2] => batman ) )
How can i get just #my , #is, #batman

No comments:

Post a Comment