Sharp Stuff
Switchblades Icepicks and german knives
Till death do us part
Axels New Music releases
Evil gear
Christmas is almost here
Viking gear
Gear Gifts and Apparel

here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.

parse a csv delimited file data array return by column index or multiple columns
column array fgetscsv delimited csv file array associative

<?php

function buildArray($File) { 
        
$handle fopen($File"r"); 
        
$fields fgetcsv($handle1000";"); 
        while(
$data fgetcsv($handle1000";")) { 
            
$detail[] = $data
        } 
        
$x 0
        
$y 0
        foreach(
$detail as $i) { 
            foreach(
$fields as $z) {  
                
$stock[$i['0']][$z] = $i[$y]; 
                
$y++; 
            } 
            
$y 0
            
$x++; 
        } 
        return 
$stock
    } 

function &
array_pull(&$arrays$idx1) {
    
$indexes func_get_args();
    
array_shift($indexes);

    
$newArrays = array ();

    foreach (
array_keys($arrays) as $arrayKey) {
        
$newArray = array ();
        foreach (
$indexes as $index) {
            
$newArray[$index] = $arrays[$arrayKey][$index];
            unset(
$arrays[$arrayKey][$index]);
        }
        
$newArrays[$arrayKey] = $newArray;
    }

    return 
$newArrays;
}

$rs=buildArray("cart-data2.txt");

echo 
'<pre>';
//can add as many column index key names you like see format
var_dump(array_pull($rs'data3','data4')); 
echo 
'</pre>';
//exit;
?>


Add your comment.













No comments yet

Search ScriptsnTips


Php JavaScripts CGI/Perl