3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $needle = 'www'; $sentence = 'This www.google.com is the http://www.facebook.com website that https://www.amazon.com make me awesome'; $pieces = explode(" ", $sentence); $urls = []; $urls = array_filter($pieces, function($v) use($needle) { return stripos($v, $needle) !== false; }); var_dump($urls);
based on qlpqm
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.3.0beta1
array(3) { [1]=> string(14) "www.google.com" [4]=> string(23) "http://www.facebook.com" [7]=> string(22) "https://www.amazon.com" }