function makeGoogleApiRequest($params)
{
$apiUrl = "https://maps.googleapis.com/maps/api/geocode/json";
$context = stream_context_create(['http'=>['timeout'=>5]]);
// Make request
$response = json_decode(file_get_contents($apiUrl . "?" . http_build_query($params), false, $context));
// Check response
if (
json_last_error() ||
!isset($response->status) ||
$response->status !== "OK" ||
!isset($response->results[0]->place_id) ||
!isset($response->results[0]->formatted_address) ||
!isset($response->results[0]->address_components) ||
!isset($response->results[0]->geometry->location->lat) ||
!isset($response->results[0]->geometry->location->lng)
) {
throw new \UnexpectedValueException ("Google Api Request Failed");
}
return $response;
}
/* Пример использования */
$place = makeGoogleApiRequest([
'address' => "Москва, Лаврушинский пер, 10",
'language' => "ru"
]);
$data = "31 -12-2030 ";
$clean = str_replace(" ", "", $data);
$splitted = explode("-", $clean);
Я обыскал все что, мог но так и не нашел нужной информации
public static function hashPassword($password,$cost=13)
{
self::checkBlowfish();
$salt=self::generateSalt($cost);
$hash=crypt($password,$salt);
if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') : strlen($hash))<32)
throw new CException(Yii::t('yii','Internal error while generating hash.'));
return $hash;
}
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
SELECT `year`, `on` FROM `table` WHERE `on`=1
UNION
SELECT `year`, '0' FROM `table` WHERE `on`=1
INSERT INTO `table` (`year`, `on`)
SELECT `inner`.`year`, '0' FROM (
SELECT * FROM `table` WHERE `on`=1
) AS `inner`
function findTheLongestSequence($str) {
$sequences = [];
$sequence = "";
for ($letterIndex=0; $letterIndex<strlen($str); $letterIndex++) {
$letter = $str[$letterIndex];
$previousLetterIndex = ($letterIndex-1);
$previousLetter = (isset($str[$previousLetterIndex]) ? $str[$previousLetterIndex] : null);
if ($previousLetter === $letter) {
if (!empty($sequence)) {
$sequences[] = $sequence;
$sequence = "";
}
} else {
$sequence .= $letter;
}
if (strlen($str)-1 === $letterIndex && !empty($sequence)) {
$sequences[] = $sequence;
}
}
usort($sequences, function($someSequence, $otherSequence) {
return strlen($otherSequence)-strlen($someSequence);
});
return $sequences[0];
}
$.each(data, function(i){
var element = this;
setTimeout(function() {
console.log("ID: " + element.ui_id);
console.log("Имя: " + element.name_market);
console.log(""+i);
}, 2000 * i, element);
});
function doAction($a, $b, $action) {
switch ($action) {
case "+": return $a + $b;
case "-": return $a - $b;
case "*": return $a * $b;
case "/": return $a / $b;
default: throw new \BadFunctionCallException("Unknown action");
}
}
<?php echo doAction($a, $b, $c) ?>