juggling and (strict) greater/lesser

PHP is famous for its type-juggling. I must admit it puzzles me, and I'm having a hard time to find out basic logical/fundamental things in comparisons. For example: If $a > $b is true and $b > $c is true, must it mean that $a > $c is always true too? Following basic logic, I would say yes however I'm that puzzled I do not really trust PHP in this. Maybe someone can provide

杂耍和(严格)大/小

PHP以其类型杂耍而闻名。 我必须承认这使我困惑,而且我很难在比较中找出基本的逻辑/基本的东西。 例如:如果$a > $b为真并且$b > $c为真,那么它是否意味着$a > $c总是真的? 遵循基本的逻辑,我会说是的,但我很困惑,我不太信任PHP。 也许有人可以提供一个例子,如果情况并非如此? 另外,我想知道严格的小于和严格的大于运算符(因为它们的含义被严格地描述为我只在过去从平等比较中知道),如果左和右操作

PHP != and == operators

This has boggled me for a while. I am running through a directory and echo'ing out its contents, and I want to exclude the ".." and "." files. Now, this code works: if ($files = scandir("temp/")) { foreach ($files as $file) { if ($file == ".." OR $file == ".") { } else { echo $file; echo "<br>";

PHP!=和==运算符

这让我有一阵子让我非常吃惊。 我正在浏览一个目录并回显其内容,我想排除“..”和“。”。 文件。 现在,这段代码有效: if ($files = scandir("temp/")) { foreach ($files as $file) { if ($file == ".." OR $file == ".") { } else { echo $file; echo "<br>"; } } } 但是这不... if ($files = scandir("temp/")) { foreach ($fil

What's this kind of syntax in PHP?

$test= <<<EOF .... EOF; I have never see it before. What's it used for? This is called HEREDOC syntax , which is a way to define strings, on multiple lines, with variable interpolation. Quoting the manual page: Heredoc text behaves just like a double-quoted string, without the double quotes. This means that quotes in a heredoc do not need to be escaped, but the escape codes

PHP中的这种语法是什么?

$test= <<<EOF .... EOF; 我从来没有见过它。 它用于什么? 这被称为HEREDOC语法 ,这是一种在多行上用变量插值定义字符串的方法。 引用手册页面: Heredoc文本的行为与双引号字符串相同,不带双引号。 这意味着heredoc中的引号不需要转义,但上面列出的转义码仍然可以使用。 变量被扩展了,但是当像在字符串中那样在heredoc中表达复杂的变量时必须同样小心。 (还有更多内容需要阅读,我没有从手册页复制

Using <<<CON in PHP

What is the effect of the following code? $page = <<<CON <p><center>Blah blah blah</center></p> CON; What does the <<<CON do? This is known as heredoc . It's essentially a way of defining the value of a variable that spans multiple lines, and doesn't require escaping like traditional strings. The "CON" part is merely an identifier

在PHP中使用<<< CON

以下代码的作用是什么? $page = <<<CON <p><center>Blah blah blah</center></p> CON; <<<CON做什么? 这被称为heredoc 。 它本质上是一种定义跨越多行的变量的值的方法,并且不需要像传统字符串那样转义。 “CON”部分仅仅是表示值的开始和结束的标识符。 这可以更改为更熟悉的值。 $str = <<<EOD Example of string spanning multiple lines using heredoc syntax.

In PHP, what does "<<<" represent?

例如: $sql = <<<MySQL_QUERY That's heredoc syntax. You start a heredoc string by putting <<< plus a token of your choice, and terminate it by putting only the token (and nothing else!) on a new line. As a convenience, there is one exception: you are allowed to add a single semicolon after the end delimiter. Example: echo <<<HEREDOC This is a heredoc string. N

在PHP中,“<<<”代表什么?

例如: $sql = <<<MySQL_QUERY 这是heredoc语法。 您通过放置<<<加上您选择的标记来启动heredoc字符串,并通过仅将标记(并且没有其他!)放在新行上来终止它。 为了方便起见,有一个例外:允许您在结束分隔符后添加一个分号。 例: echo <<<HEREDOC This is a heredoc string. Newlines and everything else is preserved. HEREDOC; 它是使用HEREDOC语法的字符串的开始。 分隔字符串的第三

PHP expression <<<EOB

I've been developing with PHP for some years now, and recently came across this code: <?php echo <<<EOB <html> <head> <title>My title</title> </head> ... EOB; ?> I've never seen this approach to print HTML, which seems to be pretty useful and less prone to some weird variable or double quote

PHP表达式<<< EOB

我已经用PHP开发了好几年了,最近碰到了这个代码: <?php echo <<<EOB <html> <head> <title>My title</title> </head> ... EOB; ?> 我从来没有见过这种方法来打印HTML,这似乎是非常有用的,不太容易出现一些奇怪的变量或双引号语法错误。 我搜索了一些有关这方面的官方信息,只发现了一篇关于Rasmus的文章。 什么是

What does <<<END mean in PHP?

Possible Duplicates: Reference - What does this symbol mean in PHP? PHP <<<EOB I am trying to grok the use of END in the following code: $javascript_autocomplete_text = <<<END <script type="text/javascript"> function split(val) { return val.split('\n'); } </script> Heredoc syntax: A third way to delimit strings is the heredoc syntax: <<

<<< END在PHP中意味着什么?

可能重复: 参考 - 这个符号在PHP中的含义是什么? PHP <<< EOB 我试图在下面的代码中使用END: $javascript_autocomplete_text = <<<END <script type="text/javascript"> function split(val) { return val.split('\n'); } </script> Heredoc语法: 分隔字符串的第三种方法是heredoc语法:<<<。 在这个操作符之后,提供了一个标识符,然后是一个换行符。

Strange print behaviour in PHP?

This question already has an answer here: Reference — What does this symbol mean in PHP? 18 answers Because it's a bitwise operator. I think it means 4 multiplied to 2^5 because that operator means Shift the bits of $a $b steps to the left (each step means "multiply by two") so it's five steps. It's 4 * 2 * 2 * 2 * 2 * 2 (But I'm guessing here; everything happ

在PHP中奇怪的打印行为?

这个问题在这里已经有了答案: 参考 - 这个符号在PHP中的含义是什么? 18个答案 因为它是一个按位运算符。 我认为这意味着4乘以2 ^ 5,因为这个算子的意思 将$ a $ b步的位移到左边(每一步意味着“乘以2”) 所以这是五个步骤。 它是4 * 2 * 2 * 2 * 2 * 2(但我在这里猜测;一切都在比特级发生)。 参考位运算符: 我们必须找到4 << 5。这意味着将4个比特移到左边: 4 is 00000000000000000000000000000100

What does >> mean in PHP?

Consider: echo 50 >> 4; Output: 3 Why does it output 3? 50 in binary is 11 0010 , shift right by 4 yields 11 which is equal to 3. See PHP documentation and Wikipedia. As documented on php.org, the >> operator is a bitwise shift operator which shifts bits to the right: $a >> $b - Shift the bits of $a $b steps to the right (each step means "divide by two")

>>在PHP中意味着什么?

考虑: echo 50 >> 4; 输出: 3 为什么输出3? 二进制中的50是11 0010 ,右移4产生11等于3。 请参阅PHP文档和Wikipedia。 如在php.org上记录的, >>操作符是一个按位移位操作符,它将位移到右侧: $ a >> $ b - 将$ a $ b步骤的位移到右边(每一步意味着“除以2”) 二进制中的50是110010 ,并且>>操作符将这些位移到示例代码中的4个位置。 虽然这发生在一个单独的操作中,但您可以通过多

What does ^ mean in PHP?

I came across this line of code in an application I am revising: substr($sometext1 ^ $sometext2, 0, 512); What does the ^ mean? It's a bitwise operator. Example: "hallo" ^ "hello" It outputs the ASCII values #0 #4 #0 #0 #0 ( 'a' ^ 'e' = #4 ). ^ is the bitwise exclusive OR operator. For each bit in a value, it looks to see if that bit is the same in the other value;

^在PHP中意味着什么?

我在我正在修改的应用程序中遇到以下代码行: substr($sometext1 ^ $sometext2, 0, 512); ^是什么意思? 这是一个按位运算符。 例: "hallo" ^ "hello" 它输出ASCII值#0 #4 #0 #0 #0 ( 'a' ^ 'e' = #4 )。 ^是按位异或运算符。 对于一个值中的每一位,它都会查看该位在另一个值中是否相同; 如果相同,则输出0,否则输出1。 例如: 00001111 ^ 01010101 -------- 01011010 XOR(异或):