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? 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.. 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. 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 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.. Link to comment https://forums.phpfreaks.com/topic/190052-syntax-question/#findComment-1002714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.