RE: [PHP-ES] transfortmar un numero a string

From: Date: Fri, 22 Dec 2000 08:32:35 +0000
Subject: RE: [PHP-ES] transfortmar un numero a string
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-5171@lists.php.net to get a copy of this message
gracias mil.. > Para convertir > > settype (string var, string type) > Los valores posibles para type son: > "integer" > "double" > "string" > "array" > "object" > > > > > Usa esta, es mas rapida!! > > $numero = 1; > $container = "1,2,3,4"; > > > > // in PHP 4.0b3 and newer: > $pos = strpos ($container, settype ($numero, "string")); > if ($pos === false) { // note: three equal signs > // not found... > } > > // in versions older than 4.0b3: > $pos = strpos ($container, settype ($numero, "string")); > if (is_string ($pos) && !$pos) { > // not found... > } > > > > > > -----Mensaje original----- > De: Juan Icaza [mailto:juan@panamacom.com] > Enviado el: Viernes, 22 de Diciembre de 2000 05:06 a.m. > Para: lista@phpes.com > Asunto: [PHP-ES] transfortmar un numero a string > > > hola listeros > tengo una pregunta > > tengo una variable que tiene un tipo de dato numero > y tengo una cadena con un listado de numeros y quiero saber si el numero > tiene ocurrencia en la cadena de numeros > > tengo este codigo: > <? > $numero = 1; > $container = "1,2,3,4"; > > if(strstr($container,$string)) { > echo "found it."; > } else { > echo "not found."; > } > > pero siempre me sale not found > pero si pongo $numero = "1"; > si me resulta > > alguien sabe somo cambiar la variable de tipo numerica a string? > > > gracias de antemano > > > > ?>

« previous php.general.es (#5171) next »