String to Array help


What am I doing wrong here?

  $Genres = "Acoustic, Alternative, Jazz, Latin";
  $MyGenres = array($Genres);
  if (in_array("Acoustic", $MyGenres)) {
      echo "Got Acoustic";
      echo"Got nothing";

[OUTPUT] > Got nothing


You are checking for an array that does not exist. Feel free to RTFM on how to construct a proper array.


Well, you created a string, not an array. Very close to it…

Try $MyGenres = array(“Acoustic, Alternative, Jazz, Latin”);