AN INSTRUMENTAL EXPERIMENTAL

Files

PHP View: SelectedFunctions.php
<?php



function PrintVariable($Var$Flag='PRINTR') {
    
/*** $Flag - 'PRINTR' | 'EXPORT' | 'DUMP' */
    
$Dump "<pre>\n";//<code>\n
    
switch($Flag){ 
        case
'DUMP':
            
ob_start();
            
var_dump($Var);
            
$Dump.= ob_get_clean();
            
/*** ob_get_clean() essentially executes both ob_get_contents() and ob_end_clean(). */
            
break;
        case
'EXPORT':
            
$Dump.= var_export($VarTRUE);
            break;
        case
'PRINTR':
        default:
            
$Dump.= print_r($VarTRUE);
            break;
    }
    
$Dump.= "</pre>\n";//</code>\n
    
return $Dump;
}

function 
Acronym($String) {
    
/*** ucwords - Uppercase the first character of each word in a string. */
    
return preg_replace('/[^A-Z]+/e'''ucwords($String));
}

function 
Write($FP,$String,$Flag=NULL){
    
/*** FP - File Pointer - Resource Handle. */
    
switch($Flag){ 
        case
'APPEND':
            
fseek($FP,0,SEEK_END);
            break;
        case
'REWRITE':
        default:
            
ftruncate($FP,0);
            
fseek($FP,0,SEEK_SET);
            break;
    }
    return 
fwrite($FP,$String);
}

function 
JoinArrays($Array1$Array2$JoinType='FLAT'){
    
    switch(
$JoinType){
        
        case
'RECURSIVE':
            return 
array_merge_recursive($Array1$Array2);
            break;
            
        case
'FLAT':
            return 
array_merge($Array1$Array2);
            break;
            
        case
'PLUS':
            return (
$Array1 $Array2);
            break;
            
        default:
            return 
FALSE;
            break;
    }
}

?>