Re: string to array??
| From: | Steve Edberg | Date: | Thu, 17 Jan 2002 11:53:42 +0000 |
| Subject: | Re: string to array?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80901@lists.php.net to get a copy of this message | ||
Actually, you can treat a string as an array without any further processing:
$Globbot = 'dribcot';
echo $Globbot[0]; # echoes 'd'
echo $Globbot[6]; # echoes 't'
Check out 'String access by character' about halfway down the page at
http://www.php.net/manual/en/language.types.string.php
(or, in Portuguese,
http://www.php.net/manual/pt_BR/language.types.string.php
).
Actually, using the [] syntax is deprecated - using {} is the new way - but I'm a creature of habit...
-steve
At 11:57 AM +0100 1/17/02, Nick Wilson <nick@explodingnet.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 * On 17-01-02 at 11:46 * Sandeep Murphy said....-- +------------------------------------------------------------------------+ | Steve Edberg sbedberg@ucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | "Restriction of free thought and free speech is the most dangerous of | | all subversions. It is the one un-American act that could most easily | | defeat us." | | - Supreme Court Justice (1939-1975) William O. Douglas | +------------------------------------------------------------------------+hi, can i convert a string to an array?? if so how shud the syntax read?? Thnx, sandsCheck out explode() www.php.net/manual/en/function.explode.php - -- Nick Wilson Tel: +45 3325 0688 Fax: +45 3325 0677 Web: www.explodingnet.com