So I have a couple of examples with sums in PHP and they are as following:
$var = "0"; // $var = "0" string
$var++; // $var = "1"
$var+=1; // $var = 2 integer
$var += ‘c’; // $var = 2 integer
$var = $var + 1.3; // $var = 3.3 float
$var = 5 + "10 obiecte"; // $var =15
$var = 5 + "obiecte"; // $var =5 integer
But I do not understand the following one: $var = 5 + "10 obiecte"; // $var =15, why is this sum equal to 15? Does PHP takes the integer out of the string and adds it to 5? Is this somehow similar to Python? If there was something like $var = 5 + "1object0", what will the sum be like?
question from:
https://stackoverflow.com/questions/65602469/how-does-the-following-lines-of-code-work-in-php 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…