Search
 
SCRIPT & CODE EXAMPLE
 

PHP

oops concepts in php

The  PHP Object-Oriented Programming concepts are:
Class 
Objects
Inheritance
Interface
Abstraction
Magic Methods
Comment

php oop


Andomi Ansari
  <?php
class Parent {
	public function __construct() {
    	echo "Parent Created
";
    }
  	public function sayHello() {
    	echo "Hello, from Parent
";
    }
  	public function eitherHello() {
    	echo "Hello, from Parent and child if desired
";
    }
}
class Child extends Parent {
	public function __construct() {
    	echo "Child Created
";
    }
  	public function sayHello() {
    	echo "Hello, from Child
";
    }
}
$p = new Parent();	// Parent Created
$c = new Child();	// Child Created
$p->sayHello(); 	// Hello, from Parent
$c->sayHello();		// Hello, from Child
$p->eitherHello();	// Hello, from Parent and child if desired
$c->eitherHello();	// Hello, from Parent and child if desired
?>


Comment

php-oop

<?php


class My{

    public $name,$age;

    public function __construct($myName,$myAge)
    {
        $this->name = $myName;
        $this->age = $myAge;

    }
}

$me = new My("WinWinMaw",22);
//$me->name = "hhz";
//$me->age = 22;

$my = new My("Maw",20);
//$me->name = "hhz";
//$me->age = 22;

$abc = new My("abc",32);


print_r([$me,$my,$abc]);
?>


//run => php filename.php
Comment

php oops

use auth
Comment

PREVIOUS NEXT
Code Example
Php :: eloquent laravel 
Php :: curl multi exec get index 
Php :: php preg_replace callback 
Php :: add column in exesting table 
Php :: join in php 
Php :: Handling Email Verification Error for APIs 
Php :: testimonial custom post type and uses shortcode 
Php :: php calling abstract static function from inside abstrac class 
Php :: php composer copy library to public vendor folder 
Php :: can we generate alphanumeric 6 digit primary key in phpmyadmin 
Php :: Laravel Deployment to google cloud app engine flexible environment app.yaml file 
Php :: how to disable the plugins and theme editor 
Php :: php send 204 
Php :: register widget in wordpress 
Php :: General errorstring fetchAll() php 
Php :: use compose with different php version debian linux 
Php :: php how to use multi byte functions 
Php :: Best version control tools for php 
Php :: Display HTML text from a variable in laravel 
Php :: Redirect file.php to file with .htaccess | Redirect to its non .php version 
Php :: composer install error 
Php :: Save data from route 
Php :: PHP include causes white space at the top of the page 
Php :: desactivar estilos globales wordpress 5.9 
Php :: wordpress curl wp remote post timeout error 
Php :: Laravel eloquent mass assignments 
Php :: $user-id show 0 in blade laravel 8 
Php :: display woocommerce review using specific id 
Php :: how we show full name of month in posts 
Php :: how to get many of quensation php programming language 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =