Getting array length from language file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Getting array length from language file (/showthread.php?tid=78500) |
Getting array length from language file - Acuru - 01-30-2021 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 [ RE: Getting array length from language file - Acuru - 02-02-2021 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 |