Page 1 of 1

Help with PERL to PHP conversion

Posted: Thu Apr 03, 2008 4:00 am
by zeezack
I more familiar with PHP, but perhaps you guys can help me figure out what is going on with this code....


there is a section here.... that fetches the results from a mysql query...

---

--
Code

while ($sth->fetch) {
$dbs{$row[0]} = {};
$dbs{$row[0]}->{props} = [@row];
# print join(",", @row), "<BR>\n"; # 1,CELCAT,?,4,Sybase
}


now from my understanding here....

$dbs[$row[0]] = {}; - that makes it an empty array? an initializer of it..


$dbs{$row[0]}->{props} = [@row]; - now does this fill in the results into an element called props...

if you guys can explain in detail what exactly is going on here, it will help me a lot. :)

Re: Help with PERL to PHP conversion

Posted: Thu Apr 03, 2008 7:36 am
by zeezack
How do these pointers work?

Code: Select all

 
        $dbs{$db}->{tbls}->{$tbl[0]} = {};
        $dbs{$db}->{tbls}->{$tbl[0]}->{props}   = [@tbl];
        $dbs{$db}->{tbls}->{$tbl[0]}->{flds}    = [];
        $dbs{$db}->{tbls}->{$tbl[0]}->{fnc_pre} = [];
        $dbs{$db}->{tbls}->{$tbl[0]}->{fnc_pst} = [];
        $dbs{$db}->{tbls}->{$tbl[0]}->{cols}    = [];