PHP Classes

File: include/functions.php

Recommend this page to a friend!
  Packages of Kakhaber Kashmadze   DbUtils   include/functions.php   Download  
File: include/functions.php
Role: Auxiliary script
Content type: text/plain
Description: alternative functions of php: empty and var_dump
Class: DbUtils
Access and Manage MySQL, PostgreSQL or MS SQL
Author: By
Last change:
Date: 10 years ago
Size: 554 bytes
 

 

Contents

Class file image Download
<?php
/* Unlike standart empty function isEmpty also assigns true if value contains whitespaces, newlines, tabs */
function isEmpty($value){
    if(!isset($value) || empty($value) || trim($value)=='') return true;
    return false;
}


/* alternative of var_dump with pre or json formating */
function vardump($var, $task=null){
    if(!empty($task)){
        if($task=='pre'){
            echo '<div><pre>';
            var_dump($var, true);
            echo '</pre></div>';            
        }elseif($task=='json'){
            $json = json_encode((array)$var );
            echo($json);
        }
    }else{
        var_dump($var);        
    }
}