Can someone explain to me why this simple example below does not work.
In this example, the "helper" function contains a different function as a parameter ("setV" and "getV"). Within the "setV" function, the value of the variable is updated. Still, the value within the "getV" function remains the old value. What is the reason for this?
vari="Oh no... I'm old."
function init() {
helper setV
helper getV
}
function helper() {
($1)
}
function setV() {
vari="Hey! I'm new!"
}
function getV() {
echo $vari
}
init