Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,727 members, 7,955,749 topics. Date: Sunday, 22 September 2024 at 02:17 PM |
Nairaland Forum / Science/Technology / Programming / Php Experts, Really Need Your Help (1172 Views)
To programmers in Nigeria and in the world, I sincerely need your help. / Please Guys, I Really Need Some Good Laravel Ebooks / Nairalanders I Really Need Your Help (2) (3) (4)
Php Experts, Really Need Your Help by updatemachine: 4:14pm On Nov 01, 2016 |
please, I will like a good explanation of this STATIC keyword in OOP, really dnt get it from various video, ebooks... I got a bit of idea but dnt fully understand when using with this operator :: really frustrating, will like you expert to explain more, so I understand cc: guru01 dhtml18 talk2hb1 seunlanlege fincoapps others.. |
Re: Php Experts, Really Need Your Help by Codenister: 4:31pm On Nov 01, 2016 |
If a property or method is static, it means it is a class attribute as opposed to being an instance attribute. You will access a class attribute without needing to instantiate the class E.g class Example{ The static variable can then be accessed by doing : Example:: variable The same thing for a method. Unlike a situation where you'd have to do:
I believe it makes more sense now |
Re: Php Experts, Really Need Your Help by updatemachine: 4:48pm On Nov 01, 2016 |
Codenister:I think am getting it now... thanks....more input pls.. |
Re: Php Experts, Really Need Your Help by SeunLanLege(m): 4:53pm On Nov 01, 2016 |
updatemachine: In order to simplify what the ftc said. Static keyword is used when you want to call that function/variable without instantiating the class itself. Class Yay { Public function happy() { Return 'happy'; } } To use the function happy You'll have to instantiate the Yay class //Class yay is instantiated $emotion = new Yay(); $emotion->happy(); Whereas static functions can be called with the class being instantiated. Class Yay { Public static function happy() { Return 'happy'; } } //To access yay Yay::happy(); |
Re: Php Experts, Really Need Your Help by SeunLanLege(m): 4:55pm On Nov 01, 2016 |
Codenister: Dot operator is Javascript not PHP, You've been writing way too much js. |
Re: Php Experts, Really Need Your Help by updatemachine: 5:04pm On Nov 01, 2016 |
SeunLanLege:Wow! thanks... now I understand.. thanks for ur great contribution! |
Re: Php Experts, Really Need Your Help by Codenister: 8:28pm On Nov 01, 2016 |
SeunLanLege:Lol, my bad I'm so used to Java actually, I only write a little js Op, in my original answer the .(dots) should be replaced with -> |
Re: Php Experts, Really Need Your Help by talk2hb1(m): 10:11am On Nov 02, 2016 |
Codenister:Hope you happy now? And hope you didn't abandon java for php |
Re: Php Experts, Really Need Your Help by Codenister: 7:45pm On Nov 02, 2016 |
talk2hb1:Lol, I have always been happy. I didn't exactly abandon Java for php, but all the serious jobs I have done have been in php. |
Re: Php Experts, Really Need Your Help by FincoApps(m): 11:26am On Nov 03, 2016 |
OP, you understand well now right ? So no need to explain again |
(1) (Reply)
Business Intelligence & Data Warehouse Professional Needed / Your Help Is Seriously Needed... / Programmers Lets Have Some Fun..., For Intelligent Peeps Please
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20 |