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 | |
$frutas = [ | |
'banana' => 'amarela', 'limao' => 'verde', 'morango' => 'vermelho' | |
]; | |
echo $frutas['limao'] . PHP_EOL; | |
echo end($frutas) . PHP_EOL; | |
/* output | |
verde |
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 | |
namespace test; | |
final class Test | |
{ | |
public static function testMethod(array $list = []) | |
{ | |
return implode(' ', $list); | |
} | |
} |
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 | |
$url = 'http://google.com'; | |
echo 'host:' . parse_url($url)['host'] . PHP_EOL; | |
echo 'scheme:' . parse_url($url)['scheme']; | |
/* | |
output | |
host:google.com |
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
<!DOCTYPE html> | |
<html dir="ltr"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>base64</title></title> | |
<script type='text/javascript' src='js.js'></script> | |
<link rel="stylesheet" href="css.css" type="text/css" media="screen" /> | |
</head> | |
<body> | |
<div class="image-list"> |
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 | |
final class DataUri { | |
protected $file; | |
public function __construct($file) { | |
$this->file = $file; | |
return $this; |
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
data:image/jpeg; charset=binary;base64,/9j/4AAQSkZJRgABAQABLAEsAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAHbAdkDASIAAhEBAxEB/8QAHQAAAgIDAQEBAAAAAAAAAAAAAAECBAMFBgcICf/EAEwQAAEDAwIDBAcDCgMGBQQDAAEAAgMEBREhMQYSQRNRYXEHFCIygZGhUrHBFSMkM0JDU2Jy0XOS4RY0Y4OToggXNkSCJjVVsmTi8f/EABkBAAMBAQEAAAAAAAAAAAAAAAABAgMEBf/EACMRAQEAAwABBQEAAwEAAAAAAAABAgMREgQTFCExQSIyUWH/2gAMAwEAAhEDEQA/APpBCSApBoQUgkDQhBSSCkhCFAJ5Heq1TN2Ubiq1rqXTF4cp8vvi5PpskJIVopoSCZTB5TCx5UgUgkUksoKRwykEsoSVxkBwDqlzZ6qJKQTJMnRJrtVEoB10QbIXZSOyxySMiaXyuaxo3LjgBc5cOOeHqOUwyXGOWUfsU7XSn/tBSuRzCumQN1wk3pDieSKC03CcdHPaIQf82v0VKXjm+OP6PaKGFv8Axqpzj8msH3qPOK9uvSeiWV5c/i3imQ5a60RDu7F7z9XBYX8Q8USb3GgZ/RR/3cUvdxV7NesBB2XkovfE2db20DubSRj7wVL8u8St1F4if4PpGa/LCPdh+xXq+UwcFeWx8U8Tx/8AuLdJ/XTEfc5WIeM+IGHM1Ja5/wCl8kZ+4om2FdFemE6JDdefR+kGZjsVlhqmj7VPMyUfI8pW2o+PeH5uVlRUy0UvUVUL4/qRj6q/OJ9uutJwol+ir01ZT1kfaUlRFPE7Z0bg4H5LKn1Fx |
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 require_once 'DataUri.php'; ?> | |
<!DOCTYPE html> | |
<html dir="ltr"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>base64</title></title> | |
<script type='text/javascript' src='js.js'></script> | |
<link rel="stylesheet" href="css.css" type="text/css" media="screen" /> | |
</head> | |
<body> |
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 | |
$obj = Test::testMethod('Isso é uma string'); | |
/* output: | |
Catchable fatal error: Argument 1 passed to test\Test::testMethod() must be an array, string given, | |
*/ |
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 | |
class Pessoa { | |
public static function contratar(PessoaFisica $obj) { | |
return $obj->nome . ' contratado!'; | |
} | |
} | |
class PessoaFisica extends Pessoa { |
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 | |
class PessoaJuridica extends Pessoa { | |
protected $nome; | |
public function __construct($nome) { | |
$this->nome = $nome; | |
} | |
} |