Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
PHP - I have a string that looks like an array

I get from my database a string that looks like:

    $result = "[02,04,05,09,21]";

And that works as a string all together, is that possible that I make it an array that would like: array[0] = 02 , array[1] = 04, and so go on?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Yes this is possible:

$result = "[02,04,05,09,21]";
$result = substr($result, 1, -1);
$arr = explode(",", $result);
over 4 years ago · Santiago Trujillo Report

0

Trim the bracket notations from the string and simply explode it with comma

$result = "[02,04,05,09,21]";
$result = rtrim(ltrim($result, '['), ']');
$array  = explode(',', $result);

echo '<pre>';
print_r($array);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!