PHP Classes

File: examples/intercepting/test2.php

Recommend this page to a friend!
  Classes of Nicola Covolo   Editable   examples/intercepting/test2.php   Download  
File: examples/intercepting/test2.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Editable
Add functions and variables dynamically to objects
Author: By
Last change: Update of examples/intercepting/test2.php
Date: 2 months ago
Size: 339 bytes
 

Contents

Class file image Download
<?php
/**
 * Intercepting existing function with a function added dynamically
*/
include("../../Editable.php");
include(
"B.php");


$authorize = function()
{
    echo
"authorizing..<br>";
};

$f = new B();
$f->addPrivateFunction("authorize",$authorize);
$f->interceptFunction(array($f,"action"),array($f,"authorize"));
$f->action();


?>