xref: /PHP-8.2/ext/standard/tests/strings/strval.phpt (revision 2f92957f)
1--TEST--
2strval() function
3--FILE--
4<?php
5$foo = 'bar';
6var_dump(strval($foo));
7define('FOO', 'BAR');
8var_dump(strval(FOO));
9var_dump(strval('foobar'));
10var_dump(strval(1));
11var_dump(strval(1.1));
12var_dump(strval(true));
13var_dump(strval(false));
14var_dump(strval(array('foo')));
15?>
16--EXPECTF--
17string(3) "bar"
18string(3) "BAR"
19string(6) "foobar"
20string(1) "1"
21string(3) "1.1"
22string(1) "1"
23string(0) ""
24
25Warning: Array to string conversion in %s on line %d
26string(5) "Array"
27