5
I have several string’s (idPergunta-18, idResposta-18, idPergunta-17, idResposta-17)
Needed to write only (idPergunta, idResposta, idPergunta, idResposta)
How do I in PHP?
The goal is as follows:
Right now I have the following array coming from a $_POST
array(28) { ["privacidade-16"]=> string(1) "1" ["verificada-16"]=> string(1) "1" ["idPergunta-16"]=> string(2) "16" ["resposta-16"]=> string(5) "vitor" ["privacidade-17"]=> string(1) "1" ["verificada-17"]=> string(1) "1" ["idPergunta-17"]=> string(2) "17" ["resposta-17"]=> string(10) "2015-10-09" ["privacidade-18"]=> string(1) "1" ["verificada-18"]=> string(1) "1" ["idPergunta-18"]=> string(2) "18" ["idRespostaPre-18"]=> string(2) "19" ["privacidade-19"]=> string(1) "1" ["verificada-19"]=> string(1) "1" ["idPergunta-19"]=> string(2) "19" ["resposta-19"]=> string(3) "Rua" ["privacidade-20"]=> string(1) "1" ["verificada-20"]=> string(1) "1" ["idPergunta-20"]=> string(2) "20" ["idRespostaPre-20"]=> string(2) "22" ["privacidade-21"]=> string(1) "1" ["verificada-21"]=> string(1) "1" ["idPergunta-21"]=> string(2) "21" ["resposta-21"]=> string(4) "4465" ["privacidade-30"]=> string(1) "1" ["verificada-30"]=> string(1) "1" ["idPergunta-30"]=> string(2) "30" ["idRespostaPre-30"]=> array(4) { [0]=> string(3) "186" [1]=> string(3) "187" [2]=> string(3) "188" [3]=> string(3) "189" } }
What I need is to separate this array into an array with several arrays inside and I would have to separate it as follows
an array with: array[0] = ["privacy"]=> string(1) "1" ["verified"]=> string(1) "1" ["idPergunta"]=> string(2) "16" ["reply"]=> string(5) "Vitor"
array[1] = ["privacy-17"]=> string(1) "1" ["verified-17"]=> string(1) "1" ["idPergunta"]=> string(2) "17" ["reply"]=> string(10) "2015-10-09"
array[2] = ["privacy"]=> string(1) "1" ["verified"]=> string(1) "1" ["idPergunta"]=> string(2) "18" ["idRespostaPre"]=> string(2) "19"
from now on, this because the fields that come from the POST are dynamic or today are 10 but tomorrow can be 20
all thus separated by a trace?
– user28595
This issue seems to me another question.
– rray