dennismonsewicz Posted August 19, 2008 Share Posted August 19, 2008 I have a bit of code: while($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result,$i); echo $i . ". " . str_replace($notallowed,"",$meta->name) . "<br />"; $i++; } what does $meta->name do exactly? Quote Link to comment Share on other sites More sharing options...
Mchl Posted August 19, 2008 Share Posted August 19, 2008 It's accessing property name of object $meta. It's probably most basic part of object oriented programming. See http://pl.php.net/manual/en/language.oop5.php for more info on objects and classes. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted August 19, 2008 Author Share Posted August 19, 2008 does it work the same as this: $results = mysql_fetch_array($sql); $upload_name = $results['upload_name']; $size = $results['size']; could you say $results->upload_name? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2008 Share Posted August 19, 2008 Yes, if you use mysql_fetch_object() instead of mysql_fetch_array(). Quote Link to comment Share on other sites More sharing options...
nrg_alpha Posted August 19, 2008 Share Posted August 19, 2008 From what one book I read, it described it like this... consider the '->' to be the equivalent to 'has a'. Therefore: $meta->name is like saying: this object 'has a' property called 'name'. For better or worse, I have personally found this 'has a' to be quite nice to think of it as. This description is not meant to be hyper accurate from a computer science standpoint, but rather to looesly illustrate. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted August 19, 2008 Author Share Posted August 19, 2008 thanks for everyone's help. I have a much better understanding of it now! Quote Link to comment 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.