eval.in

Paste #38350

PHP — PHP 5.4.6, pasted 1 year ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?php
/**
 * @link http://stackoverflow.com/a/17630869/367456
 */

error_reporting(~0);

$name = 'abcde'; 

for ($i=0, $len = strlen($name); $i <= $len; $i++)
{
    echo $name[$i], "\n";
}

Program Output

a
b
c
d
e

Notice: Uninitialized string offset: 5 in /tmp/execpad-8f615db281ee/source-8f615db281ee on line 12

OK (0.008 sec real, 0.007 sec wall, 13 MB, 53 syscalls)

Fork