S.Macualiff S.Macualiff - 1 year ago 168
PHP Question

how to display matches characters in preg_match

I'd like to string matching with regular expression by using preg_match() This is my code

$string = preg_match("/http\:\/\//","http");
echo $stirng;

That is working well. But i want to display that what is the matching characters. how to do that?

Answer Source

Use $matches another parameter inside the preg_match function. Like this

// this $matches echo out as a array object then,

I hope this will work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download