This is something I don't understand. If I assign the variable $bool
the value true
, and then later in the code change it to false
, the variable $bool
looses its value?
FYI: This reassignment of values is happening in a function in the class.
class csvcheck {
function booleonChange () {
echo "<br>";
$bool = true;
echo "1. assignment of booleon: " . $bool ."<br>";
$bool = false;
echo "2. assignment of booleon: " .$bool . "<br>"; // value of $bool is lost. Why??
}
}
$csv = new csvcheck;
$csv->booleonChange();
If this code is executed in the browser, you will see this:
- assignment of booleon: 1
- assignment of booleon: