1--TEST--
2Test strval() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : string strval  ( mixed $var  )
6 * Description: Get the string value of a variable.
7 * Source code: ext/standard/string.c
8 */
9
10echo "*** Testing strval() : basic variations ***\n";
11
12error_reporting(E_ALL ^ E_NOTICE);
13
14$simple_heredoc =<<<EOT
15Simple HEREDOC string
16EOT;
17
18
19//array of values to iterate over
20$values = array(
21			// Simple strings
22/*1*/		"Hello World",
23			'Hello World',
24
25			// String with control chars
26/*3*/		"String\nwith\ncontrol\ncharacters\r\n",
27
28			// String with quotes
29/*4*/		"String with \"quotes\"",
30
31			//Numeric String
32/*5*/		"123456",
33
34			// Hexadecimal string
35/*6*/		"0xABC",
36
37			//Heredoc String
38/*7*/		$simple_heredoc
39);
40
41// loop through each element of the array for strval
42$iterator = 1;
43foreach($values as $value) {
44      echo "\n-- Iteration $iterator --\n";
45      var_dump( strval($value) );
46      $iterator++;
47};
48?>
49===DONE===
50--EXPECTF--
51*** Testing strval() : basic variations ***
52
53-- Iteration 1 --
54string(11) "Hello World"
55
56-- Iteration 2 --
57string(11) "Hello World"
58
59-- Iteration 3 --
60string(32) "String
61with
62control
63characters
64"
65
66-- Iteration 4 --
67string(20) "String with "quotes""
68
69-- Iteration 5 --
70string(6) "123456"
71
72-- Iteration 6 --
73string(5) "0xABC"
74
75-- Iteration 7 --
76string(21) "Simple HEREDOC string"
77===DONE===
78