zeezack Posted April 3, 2008 Share Posted April 3, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/ Share on other sites More sharing options...
zeezack Posted April 3, 2008 Author Share Posted April 3, 2008 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} = []; Quote Link to comment https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/#findComment-508341 Share on other sites More sharing options...
fenway Posted April 3, 2008 Share Posted April 3, 2008 I don't know what you mean by "work"... this is simply a very big associated array. Quote Link to comment https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/#findComment-508420 Share on other sites More sharing options...
effigy Posted April 3, 2008 Share Posted April 3, 2008 $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. Quote Link to comment https://forums.phpfreaks.com/topic/99335-help-with-perl-to-php-conversion/#findComment-508479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.