- Messages
- 1,682
- Reaction score
- 32
- Points
- 48
PHP:
$textbook = array(
'cantonese' => array(
'class1' => array(
array('1', 'One - Two', 'Chapter 1 to Chapter 2',
'text'),
array('3', 'Three - Five', 'Chapter 3 to Chapter5',
'text'),
array('6', 'Six - Eight', 'Chapter 6 to Chapter 8',
'text'),
),
'class2' => array(
),
),
'mandarin' => array(
'class1' => array(
),
'class2' => array(
)
)
);
that is the array where I have all the class textbooks. Now I need to be able to search through it and pick up the text from a specified chapter.
i.e. I pass on $_GET variables, ['cls'] and ['ch']
but I can't just do: $textbook[$language][$cls][$ch], because the keys are not the ['ch'] numbers
also, array_search() does not exactly work, because it doesn't search down multiple arrays.
Last edited: