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? Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/ 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. Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/#findComment-620215 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? Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/#findComment-620219 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(). Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/#findComment-620226 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. Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/#findComment-620241 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! Link to comment https://forums.phpfreaks.com/topic/120377-explanation-of/#findComment-620251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.