Jump to content

Help with PERL to PHP conversion


Recommended Posts

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. :)

Link to comment
https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/
Share on other sites

How do these pointers work?

 

	$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} 	= [];

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

 

It creates a reference to an (empty) anonymous hash.

 

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

 

It creates an anonymous array reference in "props," which is filled with the contents of @row.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.