How to print associative array in codeigniter?

Member

by samara , in category: PHP Frameworks , 10 months ago

How to print associative array in codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by hal.littel , 10 months ago

@samara 

In CodeIgniter, you can print an associative array using the print_r() function.


Here's an example:

1
2
3
4
5
6
7
8
9
$data = array(
    'name' => 'John Doe',
    'age' => 30,
    'email' => 'johndoe@example.com'
);

echo '<pre>';
print_r($data);
echo '</pre>';


This code will output the associative array in a formatted way, making it easier to read. You can include this code in your controller or view file in CodeIgniter to print the associative array.

Related Threads:

How to check if an associative array is empty in powershell?
How to print array in Symfony?
How to print values in codeigniter?
How to print the data in the array of json file in php?
How to print log file codeigniter in browser?
How to print each row value one by one in codeigniter?