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"; } ?> Quote 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. Quote 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? Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/193524-what-does-mean/#findComment-1018809 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.