php developer mode aliast print_r()/var_dump() to pr()

Small cool tip to save time.

  1. Create file /data/local/prepend.php
  2. In main files of framework add code
  3. or add it in php.ini

prepend.php


<?php 

function pr($a){
 $args = func_get_args();
 echo '<pre>';
 foreach($args as $arg){
 print_r($arg);
 }
 echo '</pre>';

}

main file of framework

<?php
if (is_file('/data/local/prepend.php')) {
    require_once '/data/local/prepend.php';
}

or in php.ini

http://php.net/manual/en/ini.core.php#ini.auto-prepend-file


auto_prepend_file="/data/local/prepend.php"

then in code to debug just use functions

pr("here", $data)

pr($_POST);