Voting

: max(eight, two)?
(Example: nine)

The Note You're Voting On

ricovox
8 years ago
What is PHP's behavior for a variable that is assigned the return value of an expression protected by the Error Control Operator when the expression encounteres an error?

Based on the following code, the result is NULL (but it would be nice if this were confirmed to be true in all cases).

<?php

$var
= 3;
$arr = array();

$var = @$arr['x']; // what is the value of $var after this assignment?

// is it its previous value (3) as if the assignment never took place?
// is it FALSE or NULL?
// is it some kind of exception or error message or error number?

var_dump($var); // prints "NULL"

?>

<< Back to user notes page

To Top