This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arrExemploMap = array(1,2,3,4,5,6,7,8,9,10); | |
$ret = array_map(function($v) { | |
return $v * $v; | |
}, $arrExemploMap); | |
var_dump($ret); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$nome = 'Adler'; | |
$sobrenome = 'Brediks'; | |
$mostraMeuNome = function() use ($nome, &$sobrenome) { | |
$sobrenome .= ' Medrado'; | |
echo "Seu nome é: $nome $sobrenome"; | |
}; | |
echo '<br>'; | |
$mostraMeuNome(); | |
echo '<br>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$nome = 'Adler'; | |
$sobrenome = 'Brediks'; | |
$mostraMeuNome = function() use ($nome, $sobrenome) { | |
$sobrenome .= ' Medrado'; | |
echo "Seu nome é: $nome $sobrenome"; | |
}; | |
$mostraMeuNome(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$funcaoExemplo = function($parametro1, $parametro2) { | |
return "Faça alguma coisa com o $parametro1 e com o $parametro2"; | |
}; | |
echo $funcaoExemplo('Hello','Função Anônima'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function funcaoExemplo($parametro1, $parametro2) { | |
return "Faça alguma coisa com o $parametro1 e com o $parametro2"; | |
} | |
echo funcaoExemplo('Hello','World'); | |
?> |
NewerOlder