Skip to content

Instantly share code, notes, and snippets.

@nauman
Created April 12, 2012 08:39
Show Gist options
  • Save nauman/2365647 to your computer and use it in GitHub Desktop.
Save nauman/2365647 to your computer and use it in GitHub Desktop.
<?php
//static variable make place in memory without initialization the object\
//static functions are class level function not object level, they cant access object level
class YourClass
{
protected $_attribute;
public function __construct() {
$this-> _attribute = 10;
echo $this -> _attribute;
}
public function yourStaticMethod() {
echo $this -> _attribute % 5;
echo "\n";
echo $this -> _attribute;
}
}
$obj = new YourClass();
$obj -> yourStaticMethod();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment