After several attempts I couldn’t figure out a efficient way to do this. I currently have a function running preg_match_all and returning three arrays like this;
array(3) {
["name"] =>
array(3) {
0 => "Google Chrome 22.0.1229.94",
1 => "LastPass for Chrome 2.0.7",
2 => "Chromatic 0.2.3"
}
["link"] =>
array(3) {
0 => "/app/mac/32956/google-chrome",
1 => "/app/mac/42578/lastpass-for-chrome",
2 => "/app/mac/32856/chromatic"
}
["description"] =>
array(3) {
0 => " - Modern and fast Web browser."
1 => " - Online password manager and form filler for Chrome."
2 => " - Easily install and updated Chromium."
}
}
I need to able to combine the three arrays like this;
array(3) {
array(3) {
["name"] = "Google Chrome 22.0.1229.94",
["link"] = "/app/mac/32956/google-chrome",
["description"] = " - Modern and fast Web browser."
}
array(3) {
["name"] = "LastPass for Chrome 2.0.7",
["link"] = "/app/mac/42578/lastpass-for-chrome",
["description"] = " - Online password manager and form filler for Chrome."
}
array(3) {
["name"] = "Chromatic 0.2.3",
["link"] = "/app/mac/32856/chromatic",
["description"] = " - Easily install and updated Chromium."
}
}
I’ve been trying to count( $values ) and doing a for loop to make new array.
This is my take, for your particular case, given your origin array is
$results: