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