Reaper0167 Posted February 27, 2010 Share Posted February 27, 2010 I was browsing around google and came across this script. What does the -> stand for? <?php include_once ("usersOnline.class.php"); $visitors_online = new usersOnline(); if (count($visitors_online->error) == 0) { if ($visitors_online->count_users() == 1) { echo "There is " . $visitors_online->count_users() . " visitor online"; } else { echo "There are " . $visitors_online->count_users() . " visitors online"; } } else { echo "<b>Users online class errors:</b><br /><ul>\r\n"; for ($i = 0; $i < count($visitors_online->error); $i ++ ) { echo "<li>" . $visitors_online->error[$i] . "</li>\r\n"; } echo "</ul>\r\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/ Share on other sites More sharing options...
trq Posted February 27, 2010 Share Posted February 27, 2010 The -> operator lets you access properties and methods of an object. In this example, $visitors_online is an object of the type usersOnline. Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/#findComment-1018771 Share on other sites More sharing options...
Reaper0167 Posted February 27, 2010 Author Share Posted February 27, 2010 So are there other ways to write that? Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/#findComment-1018772 Share on other sites More sharing options...
trq Posted February 27, 2010 Share Posted February 27, 2010 No. Well, not exactly. You can access static methods via classname::methodname(), read more at oop. Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/#findComment-1018776 Share on other sites More sharing options...
Reaper0167 Posted February 27, 2010 Author Share Posted February 27, 2010 thanks. Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/#findComment-1018809 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.