0

question in php

Who can explain this? $a=3; $b=7; function sum($b,$c) { global $a; return $c*($a.$b)/$c; } echo sum($a,$b)/$a;

19th Jun 2022, 1:39 PM
Sara Ali
Sara Ali - avatar
2 ответов
+ 2
Sara Ali sum ($a, $b) = sum (3, 7) remember there is global $a so inside function sum $a would be 3 Now sum function return $c * ($a.$b) / $c So $c is a function argument which is 7 $b is a function argument which is 3 Because we have passed 3 and 7 from the outside = sum (3, 7) Now $c * ($a.$b) = 7 * 33 Note => . is used to concat so $a.$b = 33 7 * 33 / $c = 7 * 33 / 7 = 33 Now sum($a, $b) = 33 So finally 33 / $a = 33 / 3 = 11
19th Jun 2022, 1:53 PM
A͢J
A͢J - avatar
+ 1
A͢J Thanks 🙂🙂
19th Jun 2022, 2:06 PM
Sara Ali
Sara Ali - avatar