Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As <a href="http://docs.php.net/include" rel="noreferrer"><code>include</code></a> is a special language construct and not a function, it doesn’t need paranthesis for the paremeter list:</p> <blockquote> <p>Because <code>include()</code> is a special language construct, parentheses are not needed around its argument. Take care when comparing return value.</p> </blockquote> <p>In fact it has just one parameter and wrapping it in additional parenthesis doesn’t change anything:</p> <blockquote> <p>1 ≡ (1) ≡ ((1)) ≡ (((1))) ≡ …</p> </blockquote> <p>So your statement is identical to this (the paremter is just wrapped):</p> <pre><code>require_once (('abc.php') or die("oops")); </code></pre> <p>So we have a boolean expression as parameter that is either <em>true</em> or <em>false</em>. And that values have the string equivalent of <code>"1"</code> and <code>""</code> respectively:</p> <pre><code>var_dump((string) true === "1"); var_dump((string) false === ""); </code></pre> <p>That’s the reason why get this <em>Failed opening required '1'</em> error message.</p> <p>But using parenthesis on the right place like this makes it work like you want it:</p> <pre><code>(@include_once 'abc.php') or die("oops"); </code></pre> <p>Here <code>'abc.php'</code> is clearly the parameter and the disjunction with <code>die("oops")</code> is performed on the return value of <code>include_once</code>. The <a href="http://docs.php.net/manual/en/language.operators.errorcontrol.php" rel="noreferrer"><code>@</code> operator</a> is just to ignor the error message <code>includ_once</code> will throw if the file does not exist.</p> <p>PS: <a href="http://docs.php.net/print" rel="noreferrer"><code>print</code></a> is also a special language construct and works the same way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload