Re: transfortmar un numero a string

From: Date: Thu, 21 Dec 2000 21:03:00 +0000
Subject: Re: transfortmar un numero a string
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-5172@lists.php.net to get a copy of this message
Christian Martiniera wrote: > > 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... > } > Mas rapida todavia ;) $numero = 1; $container = array(1,2,3,4); if (!in_array($numero, $container) // not found else //found Saludos, Tomas V.V.Cox

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