I have a string contain emoji.
I want extract emoji's from that string,i'm using below code but it doesn't what i want.
$string = "
Recommended for you: Get network issues from WhatsUp Gold. Not end users.
Try looking at preg_match_all
function. preg_match
stops looking after it finds the first match, which is why you're only ever getting the first emoji back.
Taken from this answer:
preg_match
stops looking after the first match.preg_match_all
, on the other hand, continues to look until it finishes processing the entire string. Once match is found, it uses the remainder of the string to try and apply another match.
So your code would become:
$string = "