1--TEST-- 2Call to date function from a method and call to date method from call_user_func 3--INI-- 4date.timezone=UTC 5--FILE-- 6<?php 7 8class Date { 9 public $date; 10 11 public function __construct($in) { 12 $this->date = date_create($in); 13 } 14 15 public function getYear1() { 16 return date_format($this->date, 'Y'); 17 } 18 19 public function getYear2() { 20 return call_user_func([$this->date, 'format'], 'Y'); 21 } 22} 23 24$d = new Date('NOW'); 25var_dump($d->getYear1()); 26var_dump($d->getYear2()); 27 28?> 29--EXPECTF-- 30string(4) "%d" 31string(4) "%d" 32