Re: Tokenizer weirdness

From: Date: Wed, 22 May 2002 21:52:18 +0000
Subject: Re: Tokenizer weirdness
Groups: php.dev 
Request: Send a blank email to php-dev+get-84282@lists.php.net to get a copy of this message
> Why do I get > > Array > ( > [0] => Array > ( > [0] => T_OPEN_TAG > [1] => Array > ( > [0] => T_STRING > [1] => phpinfo > ) > > [2] => ( > [3] => ) > [4] => ; > [5] => Array > ( > [0] => T_WHITESPACE > [1] => ) > > [6] => Array > ( > [0] => T_CLOSE_TAG > [1] => ?> > ) > > ) > > as tokens for > > <?php phpinfo(); ?> > > Note that array index [1] is missing. (It's not reallymissing, just > put under [0], not the 'root') I don't get that result. Are you post-processing it somehow? For me, the result of: var_dump(token_get_all('<?php phpinfo(); ?>')); is this: array(7) { [0]=> array(2) { [0]=> int(353) [1]=> string(6) "<?php " } [1]=> array(2) { [0]=> int(304) [1]=> string(7) "phpinfo" } [2]=> string(1) "(" [3]=> string(1) ")" [4]=> string(1) ";" [5]=> array(2) { [0]=> int(356) [1]=> string(1) " " } [6]=> array(2) { [0]=> int(355) [1]=> string(2) "?>" } } -Andrei http://www.gravitonic.com/ Any sufficiently advanced Operating System is indistinguishable from Linux. - Jim Dennis

« previous php.dev (#84282) next »