0
Good afternoon, I used an online host with php 7 and I had the following syntax
if(!saber_se_não_existe) {}
It always worked as well as this
if(saber_se_existe) {}
So much so that I rediscovered my entire code replacing EMPTY and ISSET with this one that got show but today I went to run in PHP localhost and this does not work, I had to change everything to ! Empty or Empty and PHP is also 7, what allows this is some extension? if yes, can you tell me which one? i on localhost used PHPDESKTOP both 47 and 53 give the same error but online no.
Edit
I have an IF condition that checks if a variable was set that in this case is used isset and to know if Empty is empty, ie
$existe = true;
$nao_existe = false;
Soon
if(empty($existe)) {
// não mostra pois existe
}
and
if(isset($nao_existe)) {
// mostra pois existe, mesmo estando vazia
}
as well as I can use the
unset(variavel_com_ou_sem_valor);
$varialvel_com_ou_sem_valor ? false : true;
there are many ways to do it, so much so that I discovered the example from above, that it is enough to do
if($variavel_com_ou_sem_valor) {
// se tem mostra
}
and
if(!$variavel_com_ou_sem_valor) {
// se não tem mostra
}
only this, however, my online server, both in an android emuloader and an internernet Shared, work the latter, but on my localhost with PHPDESKTOP of
Undefined index
i found your example incomplete. saber_se_existe is a count? can’t really understand what you want
– Karl Zillner
I could explain your example better?
– Kayo Bruno
@Kayobruno is not a constant, in fact it is only knowing if there is the variable or not, the yes, of course, I will reformulate
– flourigh
@Karlzillner I will redo and put something better
– flourigh