I want to know how can I split a string and store that into separate variables. Suppose I have a string "healthy,foody,fitness,food" and now I want to store each value in separate variable. I already converted them into array with explode()
Now how can i store each value in separate variable like say
$health = "healthy";
$foody = "foody";
$fitness = "fitness";
and so on.
The main purpose of doing this is, I am trying to make an E commerce website with core PHP and I have a value called "tags" in database where i store tags in comma separated values and I have to use those tags for sorting "Similar Products" and that's why I need them in separate variable so that I can
"SELECT * FROM products WHERE tags='$health' OR tags='$foody'";
You get my point right? All helps appreciated! Have a great day!