This file contains hidden or 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 | |
namespace Foo; | |
class FooClass | |
{ | |
protected $name; | |
protected $userName; | |
protected $password; |
This file contains hidden or 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 | |
namespace Bar; | |
class FooClass | |
{ | |
public function showDifference() | |
{ | |
echo 'I love namespaces!'; | |
} | |
} |
This file contains hidden or 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 | |
require_once 'Foo/FooClass.php'; | |
require_once 'Bar/FooClass.php'; | |
use Foo\FooClass; | |
use Bar\FooClass as BarClass; | |
$foo = new FooClass(); | |
$bar = new BarClass(); |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
/* Exemplo de Calculo m2 */ | |
int main(void) | |
{ | |
/* Variaveis */ | |
float largura_parede, altura_parede, area_parede, largura_vao, altura_vao, area_vao, m2_total, v_metragem, v_total; | |
int pergunta_vao; |
This file contains hidden or 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 | |
$data = array( | |
array(1,2,3,4,8), | |
array(5,6,7,9,14), | |
array(10,11,12,13,18), | |
array(20,19,17,16,15) | |
); | |
// Output the numbers in order, comma spereated | |
// 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 |
This file contains hidden or 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 | |
class Pessoa { | |
public $pais = 'Brasil'; | |
function andar($nome, $velocidade){ | |
echo $nome . ' está andando a ' . $velocidade . 'km/h'; | |
echo '</p>'; | |
echo 'País de origem: ' . $this->pais; |
This file contains hidden or 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
$arquivo = file_get_contents('imagem.png'); | |
/* | |
@ função file_put_contents para inserir conteúdo no arquivo, | |
@ re-inseri o conteúdo da variável $arquivo para não perder informação e | |
@ adicionei uma string " TEXTO" ao final do código da imagem | |
*/ |
This file contains hidden or 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
#include<stdio.h> | |
#include<stdlib.h> | |
int main(void){ | |
int opcao, senha, nr_parcelas; | |
float valor_produto, total, valor_parcela, acrescimo; | |
printf("**** Sistema Financeiro ****\n\n"); |
This file contains hidden or 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
#include<stdio.h> | |
#include<stdlib.h> | |
int main(void){ | |
int opcao, senha, nr_parcelas; | |
float valor_produto, total, valor_parcela, acrescimo; | |
printf("**** Sistema Financeiro ****\n\n"); |
This file contains hidden or 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
$db = new PDO('mysql:host=localhost:3306;dbname=db','root',''); | |
$stm = $db->prepare('SELECT * FROM db.usuario'); | |
$result = $stm->execute(); | |
$usuarios = array(); | |
while($row = $stm->fetchObject()) | |
{ | |
$usuarios[] = $row->nome; | |
} | |
/* |
OlderNewer