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
# напишите функцию: switch(a, b) которая поменяет значения в переменных a и b местами | |
# напиши функцию которая печатает таблицу умножения | |
# Через: | |
# цикл while | |
# цикл for | |
# c использованием continue, чтобы сделать таблицу умножения только для четных чисел | |
# c использованием while и break, чтобы таблица умножения была не более 20 символов |
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
$a = [ | |
'numericKey', | |
'myKey' => 'valueByStringKey', | |
]; | |
echo 'About: array array_keys(array $array)' . PHP_EOL; | |
echo 'Возвращает все ключи массива: '; | |
echo 'Имеем: ' . var_export($a, true); | |
echo 'Получаем: ' . var_export(array_keys($a), true); |
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
=== поиск по нескольким значениям === | |
findOneBy([ | |
'some' => 'one', | |
'another' => 'two', | |
]); | |
== raw sql == |
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
$domain = 'conovaloff.com'; | |
$configParams = [ | |
"private_key_bits" => 2048, | |
'private_key_type' => OPENSSL_KEYTYPE_RSA | |
]; | |
$privkey = openssl_pkey_new($configParams); | |
$data = array( |
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 Lock | |
{ | |
/** | |
* @var string | |
*/ | |
private $name; |
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
def safe_write_file(file_path, data, tmp_path_generator_callback=None): | |
""" | |
:type file_path: str | |
:param data: what write | |
:type tmp_path_generator_callback: function | |
""" | |
if os.path.isdir(file_path) or os.path.islink(file_path): | |
raise Exception('File %s must not be a link or directory' % file_path) |