PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of jooorooo   Object extend   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Object extend
Extend objects adding functions dynamically
Author: By
Last change:
Date: 10 years ago
Size: 324 bytes
 

Contents

Class file image Download
<?php

include_once "extend.php";

$t = new ObjectModify();

//add dump method
$t->dump = function($a) {
   
var_dump($a);
};

//set today
$t->dayOfWeek = date('l');

//add dump today method
$t->addMethod('today', function () {
    return
$this->dump($this->dayOfWeek);
});

//dump today method
$t->today();