User Tools

Site Tools


hello_world

Hello World

Here is an example of Hello World in Platform4PHP.

hello_world.php
<?php
echo "Hello World";

I have seen many frameworks for PHP where the hello world example is several pages long, because you need to understand several complex concepts just to get started.

In my opinion this works against the spirit of the PHP language, as I have always seen it as a “fast” and very productive language, which was easy to get into.

The vision of Platform4PHP is to be loyal to that spirit by being easy to understand, “fast”, productive and won't get in your way where you don't need it.

Therefore if you need to say Hello World, just ask PHP to say Hello World. I won't get in your way with a complex framework.

Buuut if you want to utilize the framework, you could also do this:

<?php
class HelloWorldComponent extends Component {
  function renderContent() {
    echo "Hello World";
  }
}
 
$hello_world_component = new HelloWorldComponent();
Page::renderPageStart('Hello World');
$hello_world_component->render();
Page::renderPageEnd();

A little more complex, but still easy to comprehend.

hello_world.txt · Last modified: 2023/11/18 08:46 by sahl

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki