samedi 7 mars 2020

If conditions inside a php variable

i already looked in the existing questions but nothing was close to my situation.

I would like to express a condition inside a variable. The problem is that if I use:

if($condition) {

it is true if $condition has a value, while i would like to make it true if the content of the variable is true:

$condition = ‘$_POST[‘abc’] == “xyz”’;
if($condition) {

The idea is that I store the conditions in the database, and I use them inside a while() according to the situation. I don’t know if I was clear, sorry if I wasn’t.

Hope you got the question, and thanks in advance!

Aucun commentaire:

Enregistrer un commentaire