String to Array help


#1

What am I doing wrong here?


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

[OUTPUT] > Got nothing


#2

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

http://php.net/manual/en/language.types.array.php


#3

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

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