This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// dibutuhkan untuk proses deserialisasi object | |
include("classa.inc"); | |
$s = file_get_contents('store'); | |
$a = unserialize($s); | |
// menampilkan data dengan method tampilkan() | |
echo "Data yang disimpan pada proses serialisasi dari Page 1 adalah :<br/>"; | |
echo "<h1> "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['Enter'])) { | |
if(!empty($_POST['text'])) { | |
include("classa.inc"); | |
$a = new A($_POST['text']); | |
$s = serialize($a); | |
// menyimpan variabel $s disuatu tempat yang bisa ditemukan oleh page2.php | |
if(file_put_contents('store', $s)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyClass | |
{ | |
public $var1 = 'value 1'; | |
public $var2 = 'value 2'; | |
public $var3 = 'value 3'; | |
protected $protected = 'protected var'; | |
private $private = 'private var'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
public $text; | |
public function tampilkan() { | |
echo $this->text; | |
} | |
public function __construct ($x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
public $foo = 1; | |
} | |
$a = new A; | |
$b = $a; // $a and $b are copies of the same identifier | |
// ($a) = ($b) = <id> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
public static function who() | |
{ | |
echo __CLASS__; | |
} | |
public static function test() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
public static function who() | |
{ | |
echo __CLASS__; | |
} | |
public static function test() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Class where we are going to implement typehinting | |
class Typehinting_Test{ | |
//Implementation Type Hinting in PHP | |
//Forcing to pass argument as object of class Test1 | |
public function type_hint_method(Test1 $parameter) | |
{ | |
$parameter->test_method(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bool2str($bool) | |
{ | |
if ($bool === false) { | |
return 'FALSE'; | |
} else { | |
return 'TRUE'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class test | |
{ | |
public $a; | |
private $b; | |
function __construct($a, $b) | |
{ | |
$this->a = $a; |
NewerOlder