File: examples/rewritting/test.php

Recommend this page to a friend!
  Classes of Nicola Covolo  >  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: 7 years 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 ----


?>


For more information send a message to info at phpclasses dot org.