|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-01 17:16 UTC] mattwil@php.net
[2009-06-01 17:32 UTC] shawn at shawnbiddle dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 18:00:01 2025 UTC |
Description: ------------ If token_get_all is run on a script that contains both PHP and HTML it will split T_INLINE_HTML tokens up any time it runs across an html tag starting with s. My example uses span but as I said, it's any tag starting with s. Reproduce code: --------------- <?php print_r(token_get_all('<?php echo "Hello World!"; ?><h6>Hello</h6><span class="test">Hello!</span><?php echo "Goodbye, World!"; ?>')); ?> Expected result: ---------------- Array ( [0] => Array ( [0] => 367 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 316 [1] => echo [2] => 1 ) [2] => Array ( [0] => 370 [1] => [2] => 1 ) [3] => Array ( [0] => 315 [1] => "Hello World!" [2] => 1 ) [4] => ; [5] => Array ( [0] => 370 [1] => [2] => 1 ) [6] => Array ( [0] => 369 [1] => ?> [2] => 1 ) [7] => Array ( [0] => 311 [1] => <h6>Hello</h6><span class="test">Hello!</span> [2] => 1 ) [8] => Array ( [0] => 367 [1] => <?php [2] => 1 ) [9] => Array ( [0] => 316 [1] => echo [2] => 1 ) [10] => Array ( [0] => 370 [1] => [2] => 1 ) [11] => Array ( [0] => 315 [1] => "Goodbye, World!" [2] => 1 ) [12] => ; [13] => Array ( [0] => 370 [1] => [2] => 1 ) [14] => Array ( [0] => 369 [1] => ?> [2] => 1 ) ) Actual result: -------------- Array ( [0] => Array ( [0] => 367 [1] => <?php [2] => 1 ) [1] => Array ( [0] => 316 [1] => echo [2] => 1 ) [2] => Array ( [0] => 370 [1] => [2] => 1 ) [3] => Array ( [0] => 315 [1] => "Hello World!" [2] => 1 ) [4] => ; [5] => Array ( [0] => 370 [1] => [2] => 1 ) [6] => Array ( [0] => 369 [1] => ?> [2] => 1 ) [7] => Array ( [0] => 311 [1] => <h6>Hello</h6> [2] => 1 ) [8] => Array ( [0] => 311 [1] => <s [2] => 1 ) [9] => Array ( [0] => 311 [1] => pan class="test">Hello!</span> [2] => 1 ) [10] => Array ( [0] => 367 [1] => <?php [2] => 1 ) [11] => Array ( [0] => 316 [1] => echo [2] => 1 ) [12] => Array ( [0] => 370 [1] => [2] => 1 ) [13] => Array ( [0] => 315 [1] => "Goodbye, World!" [2] => 1 ) [14] => ; [15] => Array ( [0] => 370 [1] => [2] => 1 ) [16] => Array ( [0] => 369 [1] => ?> [2] => 1 ) )