Skip to content

Commit 75bf7b9

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: Update formatterhelper.rst
2 parents 54b8291 + 47fdf40 commit 75bf7b9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/console/helpers/formatterhelper.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,15 @@ precision (default ``1``) of the result::
132132
Helper::formatTime(125); // 2 mins
133133
Helper::formatTime(125, 2); // 2 mins, 5 secs
134134
Helper::formatTime(172799, 4); // 1 day, 23 hrs, 59 mins, 59 secs
135+
136+
Formatting Memory
137+
-----------------
138+
139+
Sometimes you want to format memory to GiB, MiB, KiB and B. This is possible with the
140+
:method:`Symfony\\Component\\Console\\Helper\\Helper::formatMemory` method.
141+
The only argument is the memory size to format::
142+
143+
Helper::formatMemory(512); // 512 B
144+
Helper::formatMemory(1024); // 1 KiB
145+
Helper::formatMemory(1024 * 1024); // 1.0 MiB
146+
Helper::formatMemory(1024 * 1024 * 1024); // 1 GiB

0 commit comments

Comments
 (0)