• 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

How can I get a div content in php

Open a popup box after receiving result from ajax

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Losing session data after POST from third party website

How do I Post to .txt document before form submits

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

How to loop a tree array with unknown depth and get array blocks?

Correctly determine if date string is a valid date in that format

Wordpress add responsive srcset header image to theme

Attempt to read property "view" on null when sending password reset email

could not find driver Debian SQL Server PHP

What will the best solution for this multiple optional filter?

PHP sort array of objects by two properties

How to identify whether webp image is static or animated?

Which is faster php date functions or carbon?

About Contact Privacy policy Terms and conditions