Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda