Skip to content

ToolPhp/php-intro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Funções - Oficina de introdução à linguagem PHP

Para organizar melhor nossos scritps podemos criar funções e procedimentos. O PHP disponibiliza a estrutura function para isso:

<?php
function test($one, $other) {
    return $one . " " . $other . PHP_EOL;
}

echo test("Hello", "World");
echo test("Hello", "Luís");

// Parametros com valor padrão
function test2($one = 'Hello', $other = 'World') {
    return $one . " " . $other . PHP_EOL;
}

echo test2();
echo test2("Hi");

// Funções anônimas
$testing = function () {
    echo "Hello there!\n";
};

$testing();

Próximo item

Arquivos

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published