xref: /PHP-8.2/Zend/tests/028.phpt (revision c48b745f)
1--TEST--
2Testing function call through of array item
3--FILE--
4<?php
5
6$arr = array('strtoupper', 'strtolower');
7
8$k = 0;
9
10var_dump($arr[0]('foo') == 'FOO');
11var_dump($arr[$k]('foo') == 'FOO');
12var_dump($arr[++$k]('FOO') == 'foo');
13var_dump($arr[++$k]('FOO') == 'foo');
14
15?>
16--EXPECTF--
17bool(true)
18bool(true)
19bool(true)
20
21Warning: Undefined array key 2 in %s on line %d
22
23Fatal error: Uncaught Error: Value of type null is not callable in %s:%d
24Stack trace:
25#0 {main}
26  thrown in %s on line %d
27