Trying to get PHP code to recognize musical notes

I am trying to use functions like substr_count and strpos to find the number and location of musical notes in text, specifically the musical note that looks like this … ♪ …which I believe is an eighth note. I can’t get this to work consistently in my PHP code. For example:

In some of my PHP scripts, the following line will tell me how many musical notes are in $myText…
…yet in other of my PHP scripts, the same line does not work for me.

I think I need to be declaring a decoding type to get this to work correctly, but I haven’t identified what that is. I thought the secret was the meta tag I’ve pasted below, but I’ve added it to the beginning of my latest PHP script and the above code still does not work. Any suggestions on how I can get PHP to always recognize musical notes as musical notes? (Right now it’s recognizing the note as a hashtag, judging by the ord value that it returns for the note character.)

<meta http-equiv=”Content-type” content=”text/html; charset=utf-8″ />