How to use if condition inside string in php

前端 未结 3 718
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 06:02

I want to know if there is a way to use something like this:

$t1=1;
$t2=2;
$t3=\"$t1>$t2\";

if($t3)
   echo \"Greater\";
else
   echo \"Smaller\";
         


        
3条回答
  •  走了就别回头了
    2021-01-17 06:38

    Most likely you don't heed that and this question come out from bad design.
    Why not to make it just

    if ($t1>$t2) echo "greater";
    

提交回复
热议问题