if else在PHP中检查的条件为true


if else true condition to check in PHP

我想要一个简单的简单检查json文件是否包含最新的在开始比它应该做一些功能,如果json文件包含视频在开始比它应该做一些其他功能。这是我的PHP代码——

$url = 'http://www.hello.se/3209406a5d0f95&limit=15';
$json = json_decode(file_get_contents($url), true);
if($json['latest']['videos']){ // how can i just put a condition where if it is true than 
//do some function or if it is not true go to the next condition which is else if($json['videos']){ ...
        // do some functions
       }
else if($json['videos']){
// do some functions

我也试过这样----

$url = 'http://www.hello.se/3209406a5d0f95&limit=15';
$json = json_decode(file_get_contents($url), true);
if($json['latest']['videos'] === true){
        // do some functions
       }
else if($json['videos'] === true){
// do some functions

不适合我,谁能帮我解决这个问题。任何建议都将非常感激,提前感谢。

use isset(): http://php.net/manual/en/function.isset.php

if(isset($json['latest']['videos'])){ // how can i just put a condition where if it is true than 
//do some function or if it is not true go to the next condition which is else if($json['videos']){ ...
        // do some functions
       }
else if(isset($json['videos'])){
// do some functions