PHP Class :: Hello World

Here is my code:
[php]<?php

class Test {
function hello()
{
echo"hello";
}

public function &world()
{
	echo" world";
}

}

$test = new Test();
$test->hello()
->world();

?>[/php]

I know it can be done like:
[php]
$test = new Test();
$test->hello();
$test->world();
?>[/php]

However I want it too look like: (as I believe it’s cleaner)
[php]
$test = new Test();
$test->hello()
->world();
?>[/php]

[php]$test = new Test();
$test->hello()
->world();
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service