Segui le novità su Telegram

Basic Php in few words for my english speaking, not developers, remote co workers ... :-)

Just how to begin developing in php

Php is very easy.

you create a text file, with extension .php

In it you can write html or code. Example:

<?php echo "hello world"; ?>

A good practice is to output the text all togheter at the end, so:

#this is a comment
$hello="hello world";
echo $bdy;

every command must end with ;


##examples of if:

if (1==1) {echo "equals";} else {echo "different";}
if (1!=0) {echo "equals";} else {echo "different";}
if (!is_numeric($pagenumber)) {
        echo "error";
} else {
        echo "is a number, ok !";


is the same of:



A very useful command is: include, include_once, require, require_once
to include an external file with some commons constants, functions, and
so on.


function sum($a,$b) {
return $a+$b

Instead to add a string to another:

function addstring($a,$b) {
return $a.$b


Passing datas

How to take data from url, ex

echo $_GET["Url"];

From a form:

echo $_POST["Url"];

From an url or a form:

echo $_REQUEST["Url"];

Never, never think at datas coming from the web as something you can use
without checking them. It's a security issue.

Just to start :)

You can find many simple routines on , the great online php
manual, and others on phpclasses.

To begin install locally apache, php, mysql, phpmyadmin on ubuntu (mamp
on mac, wampserver on win), find the root of the local websites, and
create an index.php file, it is usually the first file read on a directory.

Segui le novità su Telegram oppure segui il Podcast


Condividi su Facebook

Dal 2004 accompagniamo i clienti nelle tecnologie e nel diritto