PHP explode
Say you store a csv formatted string somewhere to represent an array. For example, Johnny has items “apple|orange|banana”. Then in your code, you may parse out the items as follows: $items = "apple|orange|banana"; // retrieve it from somewhere $my_arr = explode("|", $items); if (count($my_arr) > 0){ print "Johnny has something."; }else{ print "Johnny has nothing."; } It works fine as it seems. Well, actually, you will never see the “Johnny has nothing” print out. Surprisingly, even if $items is an empty string, explode will still return an array with one element. That array is: ...