• 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

Appending data to an anchor tag

protect images from being copied

How to send parameters in soap request in php in __soapcall() function

Laravel eloquent update record without loading from database

How to display table header in every page using FPDF library?

Shortcode or PHP inside a shortcode in Wordpress

enable Apache http Authorization header

Sum array values

IlluminateDatabaseQueryException could not find driver [duplicate]

Installing Composer - Internal Error

generating a random code in php?

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

Twig - How to check if variable is a number / integer

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

About Contact Privacy policy Terms and conditions