@@ -84,6 +84,7 @@ $array = array_except_value($array, ['bar', 'baz']);
8484#### `call_in_background()`
8585
8686Calls artisan console command in background, with optional `before` and `after` sub-commands:
87+
8788```php
8889call_in_background(' foo' );
8990
@@ -101,6 +102,7 @@ call_in_background('foo:bar baz', 'sleep 0.3');
101102#### `db_is_mysql()`
102103
103104Checks if default database connection is `mysql` or not:
105+
104106```php
105107if (db_is_mysql()) {
106108 // mysql-specific code here
@@ -110,6 +112,7 @@ if (db_is_mysql()) {
110112#### `db_mysql_now()`
111113
112114Returns database datetime, using `mysql` connection:
115+
113116```php
114117$now = db_mysql_now();
115118
@@ -119,6 +122,7 @@ $now = db_mysql_now();
119122#### `db_mysql_variable()`
120123
121124Returns value of specified `mysql` variable, or `false` if variable doesn' t exist:
125+
122126` ` ` php
123127$hostname = db_mysql_variable(' hostname' );
124128
@@ -130,6 +134,7 @@ $hostname = db_mysql_variable('hostname');
130134# ### `get_dump()`
131135
132136Returns nicely formatted string representation of the variable, using [Symfony VarDumper Component](http://symfony.com/doc/current/components/var_dumper/introduction.html) with all of it' s benefits:
137+
133138```php
134139$array = [
135140 ' a simple string' => ' in an array of 5 elements' ,
@@ -154,6 +159,7 @@ $dump = get_dump($array);
154159#### `is_email()`
155160
156161Checks if specified string is valid email address or not:
162+
157163```php
158164$isEmail = is_email(' john.doe@example.com' );
159165
@@ -163,6 +169,7 @@ $isEmail = is_email('john.doe@example.com');
163169#### `to_rfc2822_email()`
164170
165171Converts addresses data to [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html) string, suitable for PHP [mail()](http://ua2.php.net/manual/en/function.mail.php) function:
172+
166173```php
167174$address = to_rfc2822_email([
168175 [' address' => ' john.doe@example.com' , ' name' => ' John Doe' ],
@@ -173,6 +180,7 @@ $address = to_rfc2822_email([
173180```
174181
175182Also supports simplified syntax for single address item:
183+
176184```php
177185$address = to_rfc2822_email([' address' => ' john.doe@example.com' , ' name' => ' John Doe' ]);
178186
@@ -182,6 +190,7 @@ $address = to_rfc2822_email(['address' => 'john.doe@example.com', 'name' => 'Joh
182190#### `to_swiftmailer_emails()`
183191
184192Converts addresses data to format, which is suitable for [SwiftMailer library](http://swiftmailer.org/docs/messages.html):
193+
185194```php
186195$addresses = to_swiftmailer_emails([
187196 [' address' => ' john.doe@example.com' , ' name' => ' John Doe' ],
@@ -192,6 +201,7 @@ $addresses = to_swiftmailer_emails([
192201```
193202
194203Also supports simplified syntax for single address item:
204+
195205```php
196206$address = to_swiftmailer_emails([' address' => ' john.doe@example.com' , ' name' => ' John Doe' ]);
197207
@@ -203,6 +213,7 @@ $address = to_swiftmailer_emails(['address' => 'john.doe@example.com', 'name' =>
203213#### `format_bytes()`
204214
205215Formats bytes into kilobytes, megabytes, gigabytes or terabytes, with specified precision:
216+
206217```php
207218$formatted = format_bytes(3333333);
208219
@@ -214,13 +225,15 @@ $formatted = format_bytes(3333333);
214225#### `is_json()`
215226
216227Checks if specified variable is valid json-encoded string or not:
228+
217229```php
218230$isJson = is_json(' {" foo" :1," bar" :2," baz" :3}' );
219231
220232// true
221233```
222234
223235Function can return decoded json, if you pass the second `return` argument as `true`:
236+
224237```php
225238$decoded = is_json(' {" foo" :1," bar" :2," baz" :3}' , true);
226239
@@ -232,6 +245,7 @@ $decoded = is_json('{"foo":1,"bar":2,"baz":3}', true);
232245#### `str_lower()`
233246
234247Converts string to lowercase:
248+
235249```php
236250$lower = str_lower(' TeSt' );
237251
@@ -241,6 +255,7 @@ $lower = str_lower('TeSt');
241255#### `str_upper()`
242256
243257Converts string to uppercase:
258+
244259```php
245260$upper = str_upper(' TeSt' );
246261
0 commit comments