lundi 23 mars 2015

PHP OOP: value property is guaranteed different?


Imagine this code:



class Test
{
public $result;

public function makeSum($a,$b)
{
$sum = $a+$b;
$this->result = $sum;
}

}


In a webserver.


At same exact moment, two browsers call a page that performs that operation. First one has $a=1 and $b=2 and second one $a=5 and $b=4.


Are we sure that for first page $result will be 3 and for second one 9? Or is there possibility that result could be "wrong" for the page asking?


I'm talking in particular for PHP, but question can be general...


I think that will be never problems, but I would know if it's true and why.


Thank you!





Aucun commentaire:

Enregistrer un commentaire