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
[ | |
{ | |
"latitude":"-3.738846", | |
"longitude":"-38.514562", | |
"estado":"Ceará", | |
"cidade":"Fortaleza", | |
"bairro":"Centro", | |
"endereco":"R. Rocha Lima - Centro, Fortaleza - CE", | |
"iframe":"https:\/\/www.google.com\/maps\/embed?pb=!1m0!3m2!1spt-BR!2sbr!4v1482411868444!6m8!1m7!1sF%3A-MZ3kPTyTOlY%2FWFvLAGGpucI%2FAAAAAAADIMo%2FdqrkI48arNgxImUcc6Qi5dY7jdVYLqC4QCLIB!2m2!1d-4.0304584!2d-38.3036892!3f200.16869339582473!4f42.366552188365546!5f1.8581960817441479", | |
"pano":null, |
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 | |
$root = $_SERVER['DOCUMENT_ROOT']; | |
chdir($root); | |
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/'); | |
set_include_path(get_include_path().':'.__DIR__); | |
if(file_exists($root.$path)) | |
{ | |
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/') | |
$path = rtrim($path,'/').'/index.php'; | |
if(strpos($path,'.php') === false) return false; |
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 | |
function abbreviate_name(string $name): string | |
{ | |
if (strlen($name) <= 13) { | |
return $name; | |
} | |
// Removendo preposições do nome | |
$name_arr = explode(' ', preg_replace('/\s(de|da)\s/', ' ', $name)); | |
$count = count($name_arr) - 1; |
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 | |
public static function formatDate($date) | |
{ | |
$format = DateTime::ATOM; | |
if ($date instanceof DateTime) { | |
$d = $date->format($format); | |
} elseif (is_numeric($date)) { | |
$d = date($format, $date); | |
} else { |
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 | |
public static function formatDate($date) | |
{ | |
$format = DateTime::ATOM; | |
if ($date instanceof DateTime) { | |
return $date->format($format); | |
} | |
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 | |
$products = [ | |
'Geladeira' => 1500.99, | |
'Fogão' => 350, | |
'Celular' => 1190.90 | |
]; | |
function before_add_shopping_cart(array $products): array { | |
$output = [ |
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 | |
$products = [ | |
'Geladeira' => 1500.99, | |
'Fogão' => 350, | |
'Celular' => 1190.90 | |
]; | |
function format_currency($value): string { | |
return 'R$ ' . number_format($value, 2, ',', '.'); |