Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is use of _pre() method in codginiter (CI)

What is use of _pre() method in codginiter (CI):

 <?php 
      $x = array('hello', 'ram', 'shyam');
     _pre($x);    
     die;
 ?>
like image 959
user1451143 Avatar asked Dec 12 '25 20:12

user1451143


1 Answers

It's a shorthand to output your array in <pre> tags, though it's likely a user contribution and not part of the core framework.

Here's the function basically:

function _pre($arr)
{
    echo '<pre>' . print_r($arr, true) . '</pre>';
}

Now it will output your array using this formatting...

Array
(
    [0] => hello
    [1] => ram
    [2] => shyam
)

...instead of this formatting:

Array ( [0] => hello [1] => ram [2] => shyam )
like image 170
AlienWebguy Avatar answered Dec 14 '25 08:12

AlienWebguy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!