Sunday 22 November 2020

PHP ACCESS MODIFIER - Public Private and Protected

  Public Private and Protected Using PHP OOP

What is Public Keyword in PHP:

the public property, Variable  or method can be accessed from everywhere that's called as Public

Example:

<?php

/* Public Keyword*/

class pri

{

    public $name='Public Work';  // A public variable

}

class pritwo extends pri // Inherited class

{

//private Not worked

function display()

    {

        return $this->name; 

    }

    

}

$s = new pritwo;

echo "<font color=red>".$s->display()."</font>"; 


$o = new pri;

echo "<font color=green>".$o->name."<font>"; 

?>

___________________________________________________________________

Private Keyword:

The private keyword  that the declared property/method can only be accessed within the class

Private Keyword will be access in only limited scope
Example :

<?php
/* Private Keyword*/
class main
{
    private $name='Private Work';  // A public variable
function display()
    {
        return $this->name; 
    }
}
class second extends main // Inherited class
{
function display()
    {
        return $this->name; 
    }
}
$s = new second;
echo "<font color=red>".$s->display()."</font>"; 

$o = new main;
echo "<font color=green>".$o->name."<font>"; 

?>
____________________________________________________________

Protected Keyword:

Protected Properties can be access within a inherited class

the property can be accessed within the class and by classes derived from that class. 

private  the property or method can ONLY be accessed within the class.

Example:
<?php
/* Protected Keyword*/
class m
{
    protected $name='here Protected';  
}
class s extends m // Inherited class
{
function display()
    {
        return $this->name; 
    }
}
$s = new s;
echo "<font color=red>".$s->display()."</font>"; 

$o = new m;
echo "<font color=green>".$o->name."<font>"; 
?>

___________________________________________________________________

learn all the Programming and Scripting Languages with youtube.com/avadhtutor



Sunday 15 November 2020

Happy New Year Script Using CSS

Happy New Year Using CSS 

Create Files:

- avadh tutor.html

- back.jpg

- pattern.png

_____________________________________________________________________

avadh tutor.html

<style>

body

{

margin:0;

padding:0;

background:  url(back.jpg);

height: 100%; 


    /* Center and scale the image nicely */

    background-position: center;

    background-repeat: no-repeat;

    background-size: cover;

}

.banner

{

height:100vh;

}

.banner:before

{

content: '';

height:100vh;

width:100vw;

position:absolute;

top:0;

left:0;

background:  url(pattern.png);

animation: animate 10s linear infinite;

}

.text

{

color: #04619E;

font-size: 6.2em;

    width: 100%;

    text-align: center;

    text-shadow: 5px 5px 5px #B31DCE;

    font-family: Elephant;

    font-weight: bold;

}

.redtext

{

color: tomato;

font-size: 8.5em;

font-family: 'Bauhaus 93';

text-align: right;

width: 80%;

text-shadow: 5px 5px 10px rgb(0,0,0);


}

.from{

color: blue;

font-size: 3.6em;

text-align: right;

width: 80%;

font-family:Cooper;

text-shadow: 4px 5px 3px rgb(25,205,2);


}

.avadh{

color: black;

font-size: 1.2em;

width: 80%;

text-align: right;

}

@keyframes animate

{

 0%

 {

background-position: 0 0;

 }

 100%

 {


background-position : 0  550px;

  }


}

</style>


<div class="banner">

<div class="text">Happy New Year</div>

<div class="redtext">2020</div>

<div class="from">AvadhTutor - Ripal Pandya</div>

<div class="avadh">learn All Programming Languages inside youtube.com/avadhtutor </div>

</div>


_____________________________________________________________________

Right Click and save as Images :

back.jpg

Pattern.png


Learn all Programming Languages inside youtube.com/avadhtutor/