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