• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to load Codeigniter 4 lang file into an array variable

phparrayslocalizationlangcodeigniter-4


PHP Snippet 1:

return [
    'list' => [
        'Apples',
        'Bananas',
        'Grapes',
        'Lemons',
        'Oranges',
        'Strawberries'
    ]
];


$foo = lang('Fruit.list');

PHP Snippet 2:

$language = include('./Language/english.php')

PHP Snippet 3:

<?php
$locale = service('request')->getLocale();
$path = "Language/{$locale}/Validation.php";
$lang =  require APPPATH.$path; ;
var_dump($lang);
?>

Related Snippets

Laravel websockets AWS EC2 - Connection failed

Comma separated list from array with "and" before last element

Change user role if checkout custom checkbox is checked in WooCommerce

merge all files in directory to one text file

php curl_exec() Connection refused when retrieving a remote image

Hide specific products from unlogged users based in product category in WooCommerce

PHP array_filter with arguments

Querying only one row from a one to many relationship laravel

Check if string contains a value in array [duplicate]

Convert regular text to array using notepad++

PHP file_get_contents function

Group rows by column and sum another column within groups [duplicate]

Laravel Pagination links() not working

How to convert the int value to inch in PHP [closed]

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

About Contact Privacy policy Terms and conditions