constructor and destructor in php

Solutions on MaxInterview for constructor and destructor in php by the best coders in the world

showing results for - "constructor and destructor in php"
Nico
08 Mar 2018
1<?php
2/*
3    By defualt constructor call at the beginning and by defualt destructor call at the end.
4    constructor and  destructor call automatic when object is called
5*/
6    class Birds
7    {
8        function __construct() 
9        {
10            echo "Start<br>";
11        }
12        function fun1() 
13        {
14            echo "this is function<br>";
15        }
16        function __destruct() 
17        {
18            echo "End";
19        }
20    }
21    $parrot = new Birds();
22    $parrot->fun1();
23?>