Bonjour,
j'utilise la fonction eva() trouvée dans le manuel mais j'ai un peu des problèmes de syntaxe. Je fais ceci :
Et mon navigateur affiche ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 $coupon_cond = $_SESSION['coupon_cond']; $coupon_rabais = $_SESSION['coupon_rabais']; $test_total = 0; $total_fac = $order_total_display; $str = 'if ($coupon_cond){{total} - $coupon_rabais;}'; echo $str; echo ("<br/><br/>"); eval( "\$str = \"$str\";" ); $total_str = "{total}"; $str = str_replace($total_str, $total_fac, $str); echo $str;
cependant j'aimerais rajouter une variante :if ($coupon_cond){{total} - $coupon_rabais;}
if (354.00 > 200){354.00 - 100;}
conditions: {total} > 200
mais j'ai une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 $coupon_cond = $_SESSION['coupon_cond']; $coupon_rabais = $_SESSION['coupon_rabais']; $test_total = 0; $total_fac = $order_total_display; $str = 'if ($coupon_cond){$test_total = {total} - $coupon_rabais;}'; echo $str; echo ("<br/><br/>"); eval( "\$str = \"$str\";" ); $total_str = "{total}"; $str = str_replace($total_str, $total_fac, $str); echo $str;Comment dois-je modifier ma fonction eval() pour ne plus avoir ce problème ?Parse error: parse error, unexpected '=', expecting '}' in ....
Partager