sinista Posted January 27, 2010 Share Posted January 27, 2010 just been looking at some code <?php function updateStuff() { DB::query('LOCK TABLES `a`, `b`, `c` WRITE'); /* some SQL Operations */ someFunction(); /* more SQL Operations */ DB::query('UNLOCK TABLES'); } ?> my question is what does DB::query do? Quote Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/ Share on other sites More sharing options...
RussellReal Posted January 27, 2010 Share Posted January 27, 2010 DB::Query is essentially a static method call of the DB Class.. Quote Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/#findComment-1002685 Share on other sites More sharing options...
Alex Posted January 27, 2010 Share Posted January 27, 2010 :: is the scope operator. As RussellReal said, it's used for calling static methods. Which basically means the method belongs to the class itself, rather than an instance of it. Depending on how high your error reporting is set you may not get an error when trying to access a non-static method using the scope operator, so be careful. Quote Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/#findComment-1002691 Share on other sites More sharing options...
sinista Posted January 27, 2010 Author Share Posted January 27, 2010 ideal, so using :: I can use class methods without creating an object, cheers Quote Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/#findComment-1002703 Share on other sites More sharing options...
RussellReal Posted January 27, 2010 Share Posted January 27, 2010 if those methods are static.. Quote Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/#findComment-1002714 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.