|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-05-20 16:59 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 22:00:01 2026 UTC |
Description: ------------ The PHP tokenizer includes the first whitespace character after the opening php tag as a part of the opening tag. That is, the following code with one whitespace in between will be tokenized into two tokens, a start tag and a closing tag: <?php ?> While with two whitespaces in between will be tokenized into three tokens, an opening tag including one space character, a whitespace token with one space character and a closing tag: <?php ?> I hope the whitespace doesn't get lost when I submit this ;-) Reproduce code: --------------- <?php $source = "<?php ?>"; $tokens = token_get_all($source); if($tokens[1][0] == T_WHITESPACE) { print "Whitespace found\n"; } else { print "Whitespace not found\n"; } ?> Expected result: ---------------- Whitespace found Actual result: -------------- Whitespace not found