<?php
$sentence = 'This www.google.com is the http://www.facebook.com website that https://www.amazon.com make me awesome';
$pattern = '@((https?://)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\S+)?)?)*)@';
preg_match_all($pattern, $string, $matchFound);
echo '<pre>';
print_r($matchFound[0]);
Warning: Undefined variable $string in /in/QaGVl on line 6
Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/QaGVl on line 6
<pre>Array
(
)
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Warning: Undefined variable $string in /in/QaGVl on line 6
Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/QaGVl on line 6
<pre>Array
(
)
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $string in /in/QaGVl on line 6
<pre>Array
(
)