PHP Classes And Objects

PHP Oops – PHP Classes And Objects In Hindi

PHP

PHP Oops – PHP Classes And Objects In Hindi – Is Post Mai Learn Karne Wale Hai Ki PHP Class In Hindi And PHP Objects In Hindi Kiya Hote Hai|

Also Read – PHP What is OOP

PHP Classes And Objects In Hindi

PHP Object-Oriented Programming Language Hai Or PHP OOPs Concepts In Hindi Mai 2 Prakar ke program paradigm ka use Kiya Jata Hai | Yah “Procedure Oriented” Or “Object-oriented programming” Hai | Aaj Ke Time Ki Sabhi programming languages Object-oriented programming Ko Istemal Karti Hai |

Python Oops In Hindi -  Python Classes and Objects In Hindi

Jyada tar Programming Languages Mai OOP ka Concept Hota Hai | PHP Ke Object Mai Variables, Functions Ya Method Hote Hai |

For Example Agar Koi Car Hai To Us Car Ke Parts Or Color, Model Etc Ko Variables Or Functions Ya Methods Ke Jariye Likha Jata Hai |

What Is PHP OOPs Class In Hindi

Class Ek user-defined data type hai | ye C language mei structure ki Tarah hi Hota hai | Lekin classes mei Aap variable ke sath sath unse related functions Bhi Bana Sakte hai | Jinhe Aap bad mei objects ke duvara access kiya ja sakta hai |

PHP Mai Class Ko Create Karne Ke Liye Class Keyword Ka Istemal Kiya Jata Hai |

Class Definition Syntax:

<?php
class Car {
  // code goes here...
}
?>

Defining a class

<?php
class Car {
  // Properties
  public $color;
}
?>

Aap upper Diye Gaye Code Ko Dekh Sakte Hai Hamne Ek Class Car Ke Name Create Kiya Hai Or Us Class Car Ke Under Public Variable Create Kiya Hai Joki Ye Dikhata Hai Ki Class Car Ke Under Keval Ek Variable Hai |

Example:

PHP Class Ko Define Kar Diya Hai.Lekin Ab Ham Class Ke Under Function Create karte Hain set_name() for Set Karne ke Liye And get_name() for get Karne Ke Liye String Variable Ko |

<?php
class MasterPrograming {
  // Properties
  public $name;
  public $work;

  // Methods
  function set_name($name) {
    $this->name = $name;
  }
  function get_name() {
    return $this->name;
  }
}
?>

Objects

Class ek user-defined data type hai | Class type ke variables ko objects Kaha jata hai |

object creation syntax:

$object_name = class_name ;

object creation example:

$dk = new MasterPrograming();

$dk->set_name('Danish Ali');
echo $dk->get_name();

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 |

Class Output:

Danish Ali

Yadi Aapne  HTML Full Course  And CSS Full Course And Python Full Course And PHP Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

Friends Mujhe Umeed Hai Ki Aapko Class And Objects in PHP in Hindi Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mere Se Contact Kar Sakte Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *