<?php
$url = 'https://t.me/lepragram';
$curl = curl_init();
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CONNECTTIMEOUT => 20,
CURLOPT_TIMEOUT => 20,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0',
CURLOPT_REFERER => $url,
];
curl_setopt_array($curl, $options);
$html = curl_exec($curl);
curl_close($curl);
preg_match('#>([^>]+)member#isu', $html, $matches);
$members = (int)preg_replace('!\s+!', '', $matches[1]);
var_dump($members); //int(355410)
<?php
$keyboard_ru = [
1 => [], 2 => ['А','Б','В','Г',], 3 => ['Д','Е','Ж','З',],
4 => ['И','Й','К','Л',], 5 => ['М','Н','О','П',], 6 => ['Р','С','Т','У',],
7 => ['Ф','Х','Ц','Ч',], 8 => ['Ш','Щ','Ъ','Ы',], 9 => ['Ь','Э','Ю','Я',],
0 => [],
];
$keyboard_en = [
1 => [], 2 => ['A','B','C',], 3 => ['D','E','F',],
4 => ['G','H','I',], 5 => ['J','K','L',], 6 => ['M','N','O',],
7 => ['P','Q','R','S'], 8 => ['T','U','V',], 9 => ['W','X','Y','Z',],
0 => [],
];
$input_str = 757;
$variants_ru = get_variants($keyboard_ru, $input_str);
print_r($variants_ru);
$variants_en = get_variants($keyboard_en, $input_str);
print_r($variants_en);
function get_variants($keyboard, $input_str)
{
$input_codes = str_split($input_str, 1);
$groups = [];
foreach($input_codes as $idx => $code) {
foreach($keyboard as $num_code => $chars) {
if($num_code == $code && !empty($chars))
{
foreach($chars as $char) {
$groups[$idx][] = $char;
}
}
}
}
//get combinations
$result = array(array());
foreach ($groups as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
}
$result = $tmp;
}
return array_map('join', $result);
}
/**
* Check if all requirements are available
*
* @return void
*/
private function checkRequirements()
{
if ( ! function_exists('finfo_buffer')) {
throw new MissingDependencyException(
"PHP Fileinfo extension must be installed/enabled to use Intervention Image."
);
}
}
<?php
$arr = array("name" => "1", "name2" =>"2");
var_dump(
max($arr)
); //string(1) "2"
<?php
$arr = array("name" => "1", "name2" =>"2");
var_dump(
array_search(max($arr), $arr)
); //string(5) "name2"
<img src=".*?((/img/[^"]+)/thumbs/([^"]+))".*alt="(.*?)"[^>]*class="([^"]*popup-img[^"]*)"[^>]*>
<a class="$5" href="..$2/$3" title="$4" style="background: url('..$1');-webkit-background-size: cover;background-size: cover;"></a>
DESCRIBE tablename;
PRAGMA table_info(`tablename`)
information_schema
SELECT
COLUMN_NAME
FROM
information_schema.COLUMNS
WHERE
TABLE_NAME = 'users';
<?php
$statement = $pdo->query('DESCRIBE users');
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);
sort ($file); // сортируем по алфавиту
$file = array_map('trim', $file); // <---------------
$file = array_unique($file); // убираем повторы