Skip to content

Commit af4c06e

Browse files
committed
IHF: format_xml helper readme info added.
1 parent bdb96bc commit af4c06e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Provides Laravel-specific and pure PHP helper functions.
5151
- [Format](#format)
5252
- [get_dump](#get_dump)
5353
- [format_bytes](#format_bytes)
54+
- [format_xml](#format_xml)
5455
- [backtrace_as_string](#backtrace_as_string)
5556
- [minimized_backtrace_as_string](#minimized_backtrace_as_string)
5657
@@ -223,6 +224,33 @@ $formatted = format_bytes(3333333);
223224
// 3.18 MB
224225
```
225226
227+
#### `format_xml()`
228+
229+
Formats xml string using new lines and indents:
230+
231+
```php
232+
$formatted = format_xml('<?xml version="1.0"?><root><task priority="low"><to>John</to><from>Jane</from><title>Go to the shop</title></task><task priority="medium"><to>John</to><from>Paul</from><title>Finish the report</title></task><task priority="high"><to>Jane</to><from>Jeff</from><title>Clean the house</title></task></root>');
233+
234+
// <?xml version="1.0"?>
235+
// <root>
236+
// <task priority="low">
237+
// <to>John</to>
238+
// <from>Jane</from>
239+
// <title>Go to the shop</title>
240+
// </task>
241+
// <task priority="medium">
242+
// <to>John</to>
243+
// <from>Paul</from>
244+
// <title>Finish the report</title>
245+
// </task>
246+
// <task priority="high">
247+
// <to>Jane</to>
248+
// <from>Jeff</from>
249+
// <title>Clean the house</title>
250+
// </task>
251+
// </root>
252+
```
253+
226254
#### `backtrace_as_string()`
227255
228256
Returns backtrace without arguments as string:

0 commit comments

Comments
 (0)