Answer the question
In order to leave comments, you need to log in
How to make an if else output if there is and is not?
It is necessary to display if the community is banned, then I display the error "Community banned", if not banned, then we do not display anything.
I do so
$group = json_decode(file_get_contents("https://api.vk.com/method/groups.getById?group_ids={$groupId}&v=5.67"),true);
if($group['response'][0]['deactivated'] == "banned"){
$error_code = "<br><div class=\"callout callout-danger\"> Сообщество заблокировано!</div>";
}
else{
$error_code = "";
}
$group['response'][0]['deactivated']
Answer the question
In order to leave comments, you need to log in
if( isset( $group['response'],$group['response'][0], $group['response'][0]['deactivated'])
&&
$group['response'][0]['deactivated'] === "banned"
){ // ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question