Answer the question
In order to leave comments, you need to log in
How to parse an array into a variable?
The table has a field with data like [17650,17776,17777]
How can I use php to get each value from [] without a comma into a variable?
So that later the cycle could display each value separately.
Answer the question
In order to leave comments, you need to log in
$string = '[17650,17776,17777]';
preg_match_all('/\d+/', $string, $matches);
var_dump($matches[0]);
$string = '[17650,17776,17777]';
$array = eval("return " . $string . ";");
var_dump($array[0]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question