downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

debug_zval_dump> <Constantes predefinidas
Last updated: Thu, 17 Sep 2009

view this page in

Variable handling Functions

Table of Contents

  • debug_zval_dump — Dumps a string representation of an internal zend value to output
  • doubleval — Alias of floatval
  • empty — Determinar si una variable está vacía
  • floatval — Obtener el valor flotante de una variable
  • get_defined_vars — Devuelve una matriz con todas la variables definidas
  • get_resource_type — Devuelve el tipo de recurso
  • gettype — Obtener el tipo de una variable
  • import_request_variables — Importar variables GET/POST/Cookie en el contexto global
  • intval — Obtener el valor entero de una variable
  • is_array — Encuentra si una variable es una matriz
  • is_binary — Finds whether a variable is a native binary string
  • is_bool — Encuentra si una variable es de tipo booleano
  • is_buffer — Finds whether a variable is a native unicode or binary string
  • is_callable — Verifica que los contenidos de una variable puedan ser llamados como una función
  • is_double — Alias of is_float
  • is_float — Encuentra si el tipo de una variable es flotante
  • is_int — Encontrar si el tipo de una variable es entero
  • is_integer — Alias of is_int
  • is_long — Alias of is_int
  • is_null — Encuentra si una variable es NULL
  • is_numeric — Encuentra si una variable es un número o una cadena numérica
  • is_object — Encuentra si una variable es un objeto
  • is_real — Alias of is_float
  • is_resource — Encuentra si una variable es un recurso
  • is_scalar — Encuentra si una variable es un escalar
  • is_string — Encuentra si el tipo de una variable es cadena
  • is_unicode — Finds whether a variable is a unicode string
  • isset — Determinar si una variable está definida
  • print_r — Imprime información legible para humanos sobre una variable
  • serialize — Genera una representación apta para almacenamiento de un valor
  • settype — Definir el tipo de una variable
  • strval — Obtener el valor de cadena de una variable
  • unserialize — Crea un valor PHP a partir de una representación almacenada
  • unset — Remover una variable dada
  • var_dump — Vuelca información sobre una variable
  • var_export — Imprime o devuelve una representación de cadena, apta para su procesamiento, de una variable


add a note add a note User Contributed Notes
Variable handling Functions
jfrasca at sheerdev dot com
31-Aug-2005 05:27
I needed a simple function that would reduce any kind of variable to a string or number while retaining some semblance of the data that was stored in the variable. This is what I came up with:

<?
function ReduceVar ($Value) {
    switch (gettype($Value)) {
        case "boolean":
        case "integer":
        case "double":
        case "string":
        case "NULL":
            return $Value;
        case "resource":
            return get_resource_type($Value);
        case "object":
            return ReduceVar(get_object_vars($Value));
        case "array":
            if (count($Value) <= 0)
                return NULL;
            else
                return ReduceVar(reset($Value));
        default:
            return NULL;
    }
}
?>
skelley at diff dot nl
22-Sep-2001 11:55
Sorry to say Mykolas, but your definition would not be correct.

isempty() evaluates to true for NULL, 0, "", false or 'not set' for any variable, object etc. that can be set to a value.

isset() evaluates to true if the variable, object etc. exists at all, whether it is 'empty' or not.

Example:
$foo = 0;
isset($foo); //will evaluate to true.
!empty($foo); //will evaluate to false.

unset($foo);
isset($foo); //will evaluate to false.
!empty($foo); //will evaluate to false.

debug_zval_dump> <Constantes predefinidas
Last updated: Thu, 17 Sep 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites