开发者

Less-than operator failing in a PHP string

开发者 https://www.devze.com 2022-12-27 11:56 出处:网络
var_dump(\'<a>\') // or var_dump(\"<a>\") // or var_dump(\"\\x3Ca>\")开发者_StackOverflow社区
var_dump('<a>')
// or
var_dump("<a>")
// or
var_dump("\x3Ca>")开发者_StackOverflow社区

// all result in
string(3) ""

What is going on? Only putting a space after the less-than sign works for me.

PHP Version 5.2.10-2ubuntu6.4


The <a> is probably getting rendered as an empty tag in the browser - try viewing the page source


I believe var_dump takes an expression, not a string. So:

<?php

$a = "<a>";
var_dump($a); 

?>

Should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消