I have a huge problem. I'm trying to solve it for like 2 days with no luck. I know how to echo a preg_match_all with foreach, but this time with no luck. I always get an empty array output. I've tested the regex with QuRegExmm and it's working. Anybody want to help I'm trying to pregmatch proxy's with port here is the code snipplet <?php $url="http://hotproxy.org.ru/http/index.php"; $html = file_get_contents($url); $regex = '/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\:[0-9]+)/s'; preg_match($regex,$htm,$match); print_r($match); ?> Code (markup):
Now i feel like a idiot . I tough there was a problem with echoing. No wonder the only output was a empty array. Freaking typo. Thanks for your help
xchris, people always make typos, it is quite common error. You have created correct regexp and that is good. Now you can proceed with your development. Focus on positive things! Good luck!
He uses print_r which recursively prints the array out...He would use $preg[0] or whatever the variable name is after words..
when printing arrays these are the best mothos echo "<pre>"; var_dump($var); echo "</pre>"; PHP: and echo "<pre>"; print_r($var); echo "</pre>"; PHP: these make he code look really neet so u can see whats in your variables[]