예제 #1
0
 public function __construct()
 {
     $this->privatePropertyWithoutDefaultValue = 'construct';
     $this->protectedPropertyWithoutDefaultValue = 'construct';
     $this->publicPropertyWithoutDefaultValue = 'construct';
     $this->privatePropertyWithDefaultValue = 'construct';
     $this->protectedPropertyWithDefaultValue = 'construct';
     $this->publicPropertyWithDefaultValue = new SampleClass3();
     $this->publicPropertyWithDefaultValue->property = range(1, 3);
     self::$staticPrivatePropertyWithoutDefaultValue = 'construct';
     self::$staticProtectedPropertyWithoutDefaultValue = 'construct';
     self::$staticPublicPropertyWithoutDefaultValue = 'construct';
     self::$staticPrivatePropertyWithDefaultValue = 'construct';
     self::$staticProtectedPropertyWithDefaultValue = 'construct';
     self::$staticPublicPropertyWithDefaultValue = 'construct';
 }
예제 #2
0
// we will build library in case if it not exist
if (! file_exists($sLibraryPath)) {
    ini_set("phar.readonly", 0); // Could be done in php.ini

    $oPhar = new Phar($sLibraryPath); // creating new Phar
    $oPhar->setDefaultStub('index.php', 'classes/index.php'); // pointing main file which require all classes
    $oPhar->buildFromDirectory('classes/'); // creating our library using whole directory

    $oPhar->compress(Phar::GZ); // plus - compressing it into gzip
}

// when library already compiled - we will using it
require_once('phar://'.$sLibraryPath.'.gz');

// demonstration of work
$oClass1 = new SampleClass();
echo $oClass1->getAnyContent();
echo '<pre>';
print_r($oClass1);
echo '</pre>';

$oClass2 = new SampleClass2();
echo $oClass2->getAnyContent();
echo $oClass2->getContent2();
echo '<pre>';
print_r($oClass2);
echo '</pre>';

?>