Table of Contents

Undocumented stuff

Feel free to document anything presented here. Entries linking to user notes have not been confirmed, so may or may not need documentations (or demonstrate real bugs) but they are worth exploring.

PHP 6

<?php
 
$unicode = '傀傂两亨乄了乆刄';
$binary  = b'傀傂两亨乄了乆刄';
$binary2 = (binary) $unicode;
$binary3 = b<<<FOO
傀傂两亨乄了乆刄
FOO;
 
echo strlen($unicode);
echo strlen($binary);
echo strlen($binary2);
echo strlen($binary3);
 
?>
<?php 
 
// '\Uxxxxxx' 
$str = 'U+123: \U000123'; 
// '\uxxxx' 
$str = 'U+123: \u0123'; 
// unicode(8) "U+123: ģ"
var_dump($str);
 
?>
<?php
 
$GLOBALS["\u212B"] = ' 승인 ';
// U+00C5 = Å
echo $GLOBALS["\u00C5"];
 
?>

PHP 5.3

<?php
 
class bar {
	public function show() {
		var_dump(new static);
	}
}
 
class foo extends bar {
	public function test() {
		parent::show();
	}
}
 
$foo = new foo;
$foo->test();
$foo::test();
/*
object(foo)#2 (0) {
}
object(bar)#2 (0) {
}
*/
?>
<?php
 
class foo { }
class_alias('foo', 'bar');
 
var_dump(new bar);
/*
object(foo)#1 (0) {
}
*/
 
?>
<?php
 
print <<<"FOO"
	Foobar! :)
FOO;
 
?>

user_ini.filename and user_ini.cache_ttl.

PHP 5.x

<?php 
 
interface iTest { }
 
class baz implements iTest {}
 
class bar { }
 
class foo extends bar {
    public function testFoo(self $obj) {
        var_dump($obj);
    }
    public function testBar(parent $obj) {
        var_dump($obj);
    }
    public function testBaz(iTest $obj) {
        var_dump($obj);
    }
}
 
$foo = new foo;
$foo->testFoo(new foo);
$foo->testBar(new bar);
$foo->testBaz(new baz);
$foo->testFoo(new stdClass); // Catchable fatal error
 
?>
<?php
 
$foo = new stdClass;
 
$foo->{'foo-bar'} = 'foo!';
 
var_dump($foo);
/*
object(stdClass)#1 (1) {
  ["foo-bar"]=>
  string(4) "foo!"
}
*/
?>

Others

<?php
 
class foo {
    private $bar = 42;
 
}
 
$obj = new foo;
$propname="\0foo\0bar";
$a = (array) $obj;
echo $a[$propname];
 
?>
<?php
class ToString
{
	public function __toString()
	{
		return "1337";
	}
}
 
var_dump((int) (string) new ToString);
?>
<?php
class Test
{
	private $test;
}
 
var_dump((object) (array) new Test);
?>
<?php
 
function test(&$var) { }
 
$arr = array();
test($arr[]);
 
?>

Add example

Add Reference

User Requests

Add INSTALL Information

Errors/Aditional informations

Internals