I am making quiz feature for my website based on language files, I want to have 1 correct answer and multiple false for any one question, but number of wrong answer is not constant between questions. How can i get array length of wrong questions from language file, without needing to store number of wrong answers somewhere else. My language file has structure like bellow:
PHP Code:
return [ 1 => [ 'queston' => 'Is there question here?', 'correct' => 'Yes!', 'falses' => [ 'Nope', 'Uh... no?', 'It is somwhere else', 'I like bananas'], ], 2 => [ 'queston' => 'Do you like bananas?', 'correct' => 'Yes!', 'falses' => [ 'No', ], ];
Thread about my project that is using CodeIgniter:
02-02-2021, 01:00 PM (This post was last modified: 02-02-2021, 01:05 PM by Acuru.)
Ok, after looking into language class, and some experimenting, I figured it out, and it is much simpler as i expected In case someone will be searching for it, bellow is answer (for example as above, assuming file is named Quizzes):
PHP Code:
$lines = count(lang('Quizzes.1.falses'));
Yea... i feel little dumb
Thread about my project that is using CodeIgniter: