Ampersandwich
Members
-
Joined
-
Last visited
Solutions
-
Ampersandwich's post in Regex help! was marked as the answerDon't worry about it man. What you have there is a multidimensional array. Essentially that is an array (or arrays) within any given array. You can access these by following the path of the arrays.
Arrays can be broken up into two parts as such:
array( KEY => VALUE )
The two parts are KEY and VALUE. The key represents the access points of the array and value is the information that the array holds. So the method of accessing the value would be as:
$var[KEY] If we were to break apart a multidimensional array we would get the following:
array( KEY => array( KEY2 => VALUE ) )
So, as you can see here the inset array is actually the value of the first array. To get the inset value we can string together array keys by following the path KEY -> KEY2:
$var[KEY][KEY2]; This means if we take a look at your output, we can access "25ml" by doing:
echo $matches[0][0];
I hope that makes sense, I have a difficult time explaining things like this in full sometimes.
[EDIT]
I'd also recommend that you read up on arrays and their variations to familiarise yourself with them, as you will find yourself using them a lot in PHP. It's a vital part of the language.
-
Ampersandwich's post in Query help was marked as the answerAlmost, good call but it didn't work for me. However, this is what worked for me:
SELECT * FROM categories WHERE id NOT IN (SELECT topcat FROM categories WHERE topcat IS NOT NULL);
It was specifically the "WHERE topcat IS NOT NULL" which was needed, it's the only addition to gadgetgirl's query.