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

198
Views
string array to array of word

i have data in my mysql database "Service,House Worker" (without ""), when i access my data from the database i found (Service,House Worker) as it is, when i try to convert with (var_dump(explode(',',($CheckBoxAnswer)));) it then its return following :

array(1) { [0]=> string(26) "Service,House Worker" }

but i want something similar:

array(1)
(
    [0] => string(7) "Service"
    [1] => string(13) "House Worker"
)

$CheckBoxAnswer is contain data i pulled from mysql. i tried with var_dump(explode(',',($CheckBoxAnswer))); but its not working

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Try this:

  var_dump(explode(',',($CheckBoxAnswer[0])));

You are tring to explode an array into an another array. You need to specify the string instead.

over 4 years ago · Santiago Trujillo Report

0

First you need to trim $CheckBoxAnswer

Because by using var_dump giving string length 26 instead of 20

Then after use string replace

str_replace('/','',$CheckBoxAnswer);

After that try to use var_dump(explode(',',($CheckBoxAnswer)));

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!