Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Last active August 19, 2021 11:49
Show Gist options
  • Select an option

  • Save tadeubdev/08d933ee4539d05a9a88f82f34f349ba to your computer and use it in GitHub Desktop.

Select an option

Save tadeubdev/08d933ee4539d05a9a88f82f34f349ba to your computer and use it in GitHub Desktop.
<?php
$valor = '';
if (empty($valor)) {
echo 'Sim! Estou vazio!' . PHP_EOL;
}
if (isset($valor)) {
echo 'Sim! Eu existo na memória!' . PHP_EOL;
}
$valor = null;
if (empty($valor)) {
echo 'Sim! Estou vazio novamente!' . PHP_EOL;
}
if (isset($valor)) {
echo 'Ops! Eu não vou entrar aqui!';
}
// printa:
//
// Sim! Estou vazio!
// Sim! Eu existo na memória!
// Sim! Estou vazio novamente!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment