Hi, everyone. By repeating the variable name + number, I'd like to separate the strings.
for($i=0; $i<count($NowDbRule); $i++){
${"$nowOrder".$i} = explode(',', $NowDbRule[$i]['cu_order']);
echo "<script>console.log(".${"$nowOrder".$i}[0].")</script>"; // First Array Character Imported Well.
}
Error:
APHP Error was counted
Severity: Notice
Message: Undefined variable: nowOrder
Filename: test.php
Line Number: 338
I get an error because of ${"$nowOrder".$i} like that.
But even though I brought the first text message well in the echo part, there is an error.
And, count (${"$nowOrder".$i}); the number of arrays is also well taken.
What do you do so that the error doesn't pop up? <
php codeigniter
The error message seems to be an error caused by the nowOrder variable not being initialized.
It seems necessary to check whether the value of the nowOrder variable was previously specified.
$nowOrder = "Init"; // NowOrder must be initialized before the following code:
for($i=0; $i<count($NowDbRule); $i++){
${"$nowOrder".$i} = explode(',', $NowDbRule[$i]['cu_order']);
echo "<script>console.log(".${"$nowOrder".$i}[0].")</script>"; // First Array Character Imported Well.
}
© 2024 OneMinuteCode. All rights reserved.