Json + PHP - Show text if the value is true

0
<?php

$ch = curl_init("https://crackwatch.com/api.php"); // add your url which contains json file
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
$json = json_decode($content, true);
//print_R($json);
$count=count($json);
echo'<table><th>Juego</th><th>Protección</th>';
for($i=0;$i<$count;$i++)
{
  echo'<tr><td>'.$json[$i]['post_title'].'</td><td>'.$json[$i]['cracked'].'</td></tr>';


}
echo'</table>';

?>

The value of the json in a part indicates "cracked": false, or "cracked": true,

When I print the result I figure 1 and in what says false it does not appear at all, I want to show a text that says already cracked or not cracked

    
asked by Nomak 05.02.2017 в 21:03
source

1 answer

1

It would only be change:

echo'<tr><td>'.$json[$i]['post_title'].'</td><td>'.($json[$i]['cracked'] == 1? 'no ': '').'crackeado</td></tr>';
    
answered by 05.02.2017 / 21:12
source