Created
September 29, 2015 06:32
-
-
Save NaokiStark/376c6eff5c0b5e3cdf62 to your computer and use it in GitHub Desktop.
empty php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Ejemplo 1 | |
#Spected: "no empty" | |
$asd="0"; | |
if(empty($asd) == false){ | |
echo "no empty"; | |
} | |
else{ | |
echo "empty"; | |
} | |
#Result = "empty" | |
/* | |
Usar isset() para verificar si existe la variable | |
Si se trata de un entero, POR QUE PUTAS NO USÁS EL CEREBRO Y HACES "if($variable > 1)" | |
Si se trata de un string, POR QUE PUTAS NO PRUEBAS LA LONGITUD DE CARACTERES DEL STRING, ES MUCHO MÁS FACIL IMBÉCIL "if(strlen($variable)>1)" | |
Si se trata de un bool, PERO NI HABLAR. | |
Quiero saber si es null, HAZ INTENTADO CON is_null()? | |
Se aplica con los arrays, SI UN PUTO ARRAY TIENE LONGITUD 0, ESTÁ VACIO, PUTA MADRE | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment