PHP Static Methods In Hindi – OOPs In Hindi – Is Post Me Ham Static Methods And Static Properties In PHP In Hindi Ke Bare Me Dekhne Wale Hai Or Iska PHP me Kiya Istemal Hota Hai Ye Bhi Dekhne Wale Hai |
PHP Static Methods In Hindi
Static Methods Ka Istemal Karne Se Hame Class Ka Koi Bhi Object Create Karne Ki Jarurat Nhi Hoti Hai, Ham Bina Object Create Kiye Bhi Function Ya Methods Ko Call Kar Sakte Hai |
To Sabse Pahle Ham Class Ka Object Bana Ke Ek Program Banate Hai Or Uske Bad Ham Static Ka Istemal Karte Hai, Aisa Karne se Hame Jyada Understing Ho jayegi Ki |
Example:
<?php class MasterPrograming { // Properties public $name; // Methods public function show_name() { echo "Danish Ali"; } } // Create a Object $dk = new MasterPrograming(); // call methods using object $dk->show_name(); ?>
Output:
Danish Ali
Aapko Pta Hoga Ki Hamne Class MasterPrograming Create Kiya Tha Upper Or Ab Hamne Us Class Ka Ek $dk Obj Create Kiya Hai | Aap Kitne Bhi object create Kar Sakte Hai |
Ab Ham Static Methods Ka Example Dekhte Hai Or Aap Easily Program Ko Samnjh Jaoge |
Static Methods Ko Create Karne Ke Liye static Keyword Ka Istemal Kiya Jata Hai And Static Methods Ko Class Ke Under Se Access Karne ke Liye double colon (::), And Method Name Ka Istemal Kiya Jata Hai |
Example:
<?php class MasterPrograming { // Properties public static $name; // Methods public static function show_name() { echo "Danish Ali"; } } // Call static method MasterPrograming::show_name(); ?>
Output:
Danish Ali
Aap Upper Diye Gaye Program And Output Ko Check Kar Sakte Hai Or Ye Bhi Aap Difference Laga Sakte Hai Ki, Static Ko PHP me Kyo Istemal Kiya Jata Hai |
Also Read – PHP What is OOP
Hello Sir,
Thank you so much for this php tutorial. This is very helpful to understand everything but MySql Databsase to PHP Timezones it is not showing any link. Please tell me how to learn
thanks but help ke liye aap mere is mail par likh kar send kar sakte -> [email protected]