Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/rewritting/test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of jstar88  >  Editable  >  examples/rewritting/test.php  >  Download  
File: examples/rewritting/test.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Editable
Add functions and variables dynamically to objects
Author: By
Last change:
Date: 1 year ago
Size: 534 bytes
 

Contents

Class file image Download
<?php
include("../../Editable.php");
include(
"B.php");

//---- replacing existing code ----
$b = new B();
$b->replaceFunction(array($b,"hello"),function(){return "world";});
$b->say();
//---- end ----


echo "<br>---<br>";

//---- replacing live code ----
$b = new B();
$b->addPrivateFunction("world",function(){return "";});
$b->replaceFunction(array($b,"world"),function(){return "World";});
$b->replaceFunction(array($b,"say"),function(){return $this->hello().$this->world() ;});
echo 
$b->say();
//$b->hello();
//---- end ----


?>