tokengetall php,PHP: token_get_all - Manual

Yes, some problems (On WAMP, PHP 5.3.0 ) with get_token_all()

1 : bug line numbers

Since PHP 5.2.2 token_get_all()  should return Line numbers in element 2..

.. but for instance (5.3.0 on WAMP), it work perfectly only with PHP code (not HMTL miwed), but if you have some T_INLINE_HTML detected by token_get_all() ,  sometimes you find wrongs line numbers  (return next line)... :(

2: bug warning message can impact loops

Warning with php code uncompleted (ex : php code line by line) :

for example if a comment tag is not closed  token_get_all()  can block loops on this  warning :

Warning: Unterminated comment starting line

This problem seem not occur in CLI mod (php command line), but only in web mod.

Waiting more stability, used token_get_all()  only on PHP code (not HMTL miwed) :

First extract entirely PHP code (with open et close php tag),

Second use token_get_all()  on the pure PHP code.

3 : Why there not function to extract PHP code (to extract HTML, we have Tidy..)?

Waiting, I used a function :

The code at end this post :

http://www.developpez.net/forums/d786381/php/langage/

fonctions/analyser-fichier-php-token_get_all/

This function not support :

- Old notation :  "  ?>" and ""

- heredoc syntax

- nowdoc syntax (since PHP 5.3.0)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值