Jump to content

PHP Class :: Hello World


miiikkeyyyy

Recommended Posts

Here is my code:

<?php

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

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

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

?>

 

I know it can be done like:

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

 

However I want it too look like: (as I believe it's cleaner)

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

Link to comment
https://forums.phpfreaks.com/topic/227348-php-class-hello-world/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.