Is there any way to get the current, after previous value of a variable while setting it? I mean:
$x = 10
$x = id() + 20; // 30
function id() {
return THE_VARIABLE_VALUE; // 10
}
Or do I need be explicit and say (?):
$x = 10
$x = id($x) + 20; // 30
function id($x) {
return $x; // 10
}
My question is:
In PHP, can I get implicitly the value of a variable?
id is trying to simulate the very known id function, that returns the own element:
id = (xs) -> xs
id 1 -- 1
id 'k' -- k