为什么php if else不能使用JSON数据

I am fetching information from my database as JSON array.The problem is i am unable to use this data to compare using if else or assign to a PHP variable.

query:

$query="select * from dmo";

$result = $mysqli->query($query) or die($mysqli->error.__LINE__);

$arr = array();
if($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $arr[] = $row;  
    }
}
# JSON-encode the response
$json_response = json_encode($arr);

// # Return the response
echo $json_response;

Data:

<tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
                    <td>{{data.tran_id}}</td>
                    <td>{{data.tran_type}}</td>
                    <td>{{data.sender}}</td>
                    <td>{{data.amount}}</td>
                    <td>{{data.fee}}</td>
                    <td>{{data.date}}</td>
                    <td>
                    <?php $s="{{data.status}}"; if ($s == "0")
                    echo"Pending"; 
                    else if ($s == "1") echo"Completed"; 
                    ?>
                    </td>


                </tr>

You haven't told us anything about how your templating engine works or which one it is, but it seems clear enough from your problem that it's not preprocessed PHP. You can't just mix technologies like that and expect it to work.

Read up about how PHP is invoked, what its result is, how that result is transferred to a browser and how that browser interprets what it's received; you'll see that what you wrote doesn't make any sense.

More than likely, the templating engine you're using will have its own conditional syntax. For example, in AngularJS you would write:

{{data.status == 1 ? "Too young" : "Old enough"}}

Have a good read through the documentation for the technologies that you use.