Welcome Guest, Not a member yet? Register   Sign In
Debuging in PHP
#4

[eluser]John_Betong[/eluser]
 
>>> Any other good ways to debug stuff in PHP and/or CI?
 

index.php
Code:
error_reporting(E_ALL | E_STRICT);
  ini_set('display_errors','On');
  
  date_default_timezone_set('Asia/Krasnoyarsk'); // Bangkok time
  define('LOCALHOST', 'localhost' === $_SERVER['SERVER_NAME']);
  define('BR', '<br />');

  //==========================================================================  
  function fred($msg=array('one', 'two', 'three'), $msg_name='$msg_name not passed') {
  echo "<pre style='text-align:left;background:#ffc none;color:#000;text-align:left'>";

        echo '<b>' .$msg_name .'</b> ==> <span>';
                print_r($msg);
                echo BR;
        echo "</span></pre>";

  }//endfunc


Code usage: // can be in controllers, views, models, libraries, etc
Code:
if (LOCALHOST)
  {
    echo BR .'None of this is shown online';

    $atest = array('one', 'two', 'three');
    fred($atest, '$atest');
  }


Messages In This Thread
Debuging in PHP - by El Forum - 04-27-2009, 04:40 PM
Debuging in PHP - by El Forum - 04-28-2009, 03:59 AM
Debuging in PHP - by El Forum - 04-28-2009, 09:32 PM
Debuging in PHP - by El Forum - 05-01-2009, 03:12 AM
Debuging in PHP - by El Forum - 05-01-2009, 03:28 AM
Debuging in PHP - by El Forum - 05-06-2009, 04:01 AM
Debuging in PHP - by El Forum - 05-06-2009, 05:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB