I'm trying to pass ${"variable_$i"}
into a function so I can use $test
. Within the function, I want to add html to ${"variable_$i"}
.
Here's the error I'm receiving:
Parse error: syntax error, unexpected '$', expecting variable
My code:
// file.php
${"variable_$i"} = $test;
getCode(${"variable_$i"}, $result);
// function.php
// error
function getCode(${"variable_$i"}, $result) {
if ($result->num_rows > 0) {
$columns = 3;
$x = 0;
${"variable_$i"} .= "<tr>";
// more code
}
}
How can I access this variable for use inside the function?
Thanks!
Comments
Post a Comment