Skip to content
Advertisement

Tag: multidimensional-array

Array inside arrays of arrays

I need help, I can’t assign the single values of the array inside the array of the array to a variable. I could assign the values of the second dimension array to single variables like this: But how can I use a second loop to count and extract the single values of the products?I have tried with a second “for”

String to Multi-Dimensional array in PHP

Imagine that I have a variable that contains following value: I want to parse this string and create actual multi-dimensional array in PHP. For example: For that purpose, first of all I tried to parse that string via regular expression: However I failed when I tried it as following: And the output is: So; How can I solve that regex

Sorting alphabetically by Array Value in Multidimensional Indexed Array After Custom Sort (usort) / Sort Array by Two Values

Original Array: Applied usort($terms, “mysort”); via the following function(s) This successfully ordered the array by the $sortOrder array in the getSortOrder function (base material first, and then color) Now I am trying to sort this new sorted array by name while keeping the previously applied sort order (base material first and then color). Expected Output: Normally I could apply a

Advertisement