From db3a62ff0c61586f171c80bd9d2ee0f5744e65ed Mon Sep 17 00:00:00 2001
From: Igor Simdyanov
Date: Sat, 7 May 2022 17:26:05 +0300
Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BB=D0=B0=D0=B2=D0=B0=2016:=20=D1=87?=
=?UTF-8?q?=D0=B5=D1=80=D0=BD=D0=BE=D0=B2=D0=B8=D0=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
strings/explode.php | 4 ++++
strings/htmlspecialchars.php | 8 ++++++++
strings/implode.php | 3 +++
strings/javascript.php | 8 ++++++++
strings/json_decode.php | 6 ++++++
strings/json_encode.php | 9 +++++++++
strings/json_encode_unescaped.php | 9 +++++++++
strings/locale_try.php | 3 +++
strings/localeconv.php | 6 ++++++
strings/nl2br.php | 9 +++++++++
strings/printf.php | 2 ++
strings/printf_color.php | 5 +++++
strings/printf_float.php | 4 ++++
strings/printf_int.php | 5 +++++
strings/printf_number.php | 9 +++++++++
strings/serialize.php | 12 ++++++++++++
strings/strip_tags.php | 10 ++++++++++
strings/wordwrap.php | 3 +++
strings/wrong_symbols.php | 5 +++++
19 files changed, 120 insertions(+)
create mode 100644 strings/explode.php
create mode 100644 strings/htmlspecialchars.php
create mode 100644 strings/implode.php
create mode 100644 strings/javascript.php
create mode 100644 strings/json_decode.php
create mode 100644 strings/json_encode.php
create mode 100644 strings/json_encode_unescaped.php
create mode 100644 strings/locale_try.php
create mode 100644 strings/localeconv.php
create mode 100644 strings/nl2br.php
create mode 100644 strings/printf.php
create mode 100644 strings/printf_color.php
create mode 100644 strings/printf_float.php
create mode 100644 strings/printf_int.php
create mode 100644 strings/printf_number.php
create mode 100644 strings/serialize.php
create mode 100644 strings/strip_tags.php
create mode 100644 strings/wordwrap.php
create mode 100644 strings/wrong_symbols.php
diff --git a/strings/explode.php b/strings/explode.php
new file mode 100644
index 0000000..e7b3922
--- /dev/null
+++ b/strings/explode.php
@@ -0,0 +1,4 @@
+';
+print_r(explode(', ', $str)); // ['Имя', 'Фамилия', 'e-mail']
diff --git a/strings/htmlspecialchars.php b/strings/htmlspecialchars.php
new file mode 100644
index 0000000..13576c3
--- /dev/null
+++ b/strings/htmlspecialchars.php
@@ -0,0 +1,8 @@
+
+ alert("Приветик!");
+
+ html;
+
+echo htmlspecialchars($text);
diff --git a/strings/implode.php b/strings/implode.php
new file mode 100644
index 0000000..ab7648f
--- /dev/null
+++ b/strings/implode.php
@@ -0,0 +1,3 @@
+
+ alert("Приветик!");
+
+ html;
+
+echo $text;
diff --git a/strings/json_decode.php b/strings/json_decode.php
new file mode 100644
index 0000000..e526c84
--- /dev/null
+++ b/strings/json_decode.php
@@ -0,0 +1,6 @@
+';
+print_r($arr);
+echo '';
diff --git a/strings/json_encode.php b/strings/json_encode.php
new file mode 100644
index 0000000..f166ebb
--- /dev/null
+++ b/strings/json_encode.php
@@ -0,0 +1,9 @@
+ 'Иван Иванов',
+ 'phones' => [
+ '916 153 2854',
+ '916 643 8420'
+ ]
+];
+echo json_encode($arr);
diff --git a/strings/json_encode_unescaped.php b/strings/json_encode_unescaped.php
new file mode 100644
index 0000000..31e1def
--- /dev/null
+++ b/strings/json_encode_unescaped.php
@@ -0,0 +1,9 @@
+ 'Иван Иванов',
+ 'phones' => [
+ '916 153 2854',
+ '916 643 8420'
+ ]
+];
+echo json_encode($arr, JSON_UNESCAPED_UNICODE);
diff --git a/strings/locale_try.php b/strings/locale_try.php
new file mode 100644
index 0000000..bed0d4e
--- /dev/null
+++ b/strings/locale_try.php
@@ -0,0 +1,3 @@
+';
+print_r(localeconv());
+echo '';
diff --git a/strings/nl2br.php b/strings/nl2br.php
new file mode 100644
index 0000000..dad14fa
--- /dev/null
+++ b/strings/nl2br.php
@@ -0,0 +1,9 @@
+
';
+echo nl2br($str);
diff --git a/strings/printf.php b/strings/printf.php
new file mode 100644
index 0000000..055b7fb
--- /dev/null
+++ b/strings/printf.php
@@ -0,0 +1,2 @@
+';
+printf('%8.2f\n', 1000.45684); // 1000.46
+printf('%.2f\n', 12.92869); // 12.93
diff --git a/strings/printf_int.php b/strings/printf_int.php
new file mode 100644
index 0000000..780513e
--- /dev/null
+++ b/strings/printf_int.php
@@ -0,0 +1,5 @@
+';
+printf('% 4d\n', 45); // ' 45'
+printf('%04d\n', 45); // '00045'
+echo '';
diff --git a/strings/printf_number.php b/strings/printf_number.php
new file mode 100644
index 0000000..0ffd97f
--- /dev/null
+++ b/strings/printf_number.php
@@ -0,0 +1,9 @@
+', $number);
+printf('Десятичное число: %d
', $number);
+printf('Число с плавающей точкой: %f
', $number);
+printf('Восьмеричное число: %o
', $number);
+printf('Строковое представление: %s
', $number);
+printf('Шестнадцатеричное число (нижний регистр): %x
', $number);
+printf('Шестнадцатеричное число (верхний регистр): %X
', $number);
diff --git a/strings/serialize.php b/strings/serialize.php
new file mode 100644
index 0000000..b7aa0f6
--- /dev/null
+++ b/strings/serialize.php
@@ -0,0 +1,12 @@
+";
+
+// Извлекаем массив из строки
+$arr = unserialize($str);
+echo '';
+print_r($arr); // [23, 45, 34, 2, 12]
+echo '
';
diff --git a/strings/strip_tags.php b/strings/strip_tags.php
new file mode 100644
index 0000000..0411eca
--- /dev/null
+++ b/strings/strip_tags.php
@@ -0,0 +1,10 @@
+Параграф.
+
+ Еще немного текста
+ html;
+
+echo htmlspecialchars(strip_tags($str));
+echo '
';
+echo htmlspecialchars(strip_tags($str, ''));
diff --git a/strings/wordwrap.php b/strings/wordwrap.php
new file mode 100644
index 0000000..15b7a41
--- /dev/null
+++ b/strings/wordwrap.php
@@ -0,0 +1,3 @@
+');
diff --git a/strings/wrong_symbols.php b/strings/wrong_symbols.php
new file mode 100644
index 0000000..ccee8f3
--- /dev/null
+++ b/strings/wrong_symbols.php
@@ -0,0 +1,5 @@
+';
+echo 'ENT_SUBSTITUTE: ' . htmlspecialchars($str, ENT_SUBSTITUTE) . '
';
+echo 'ENT_DISALLOWED: ' . htmlspecialchars($str, ENT_DISALLOWED) . '
';