printf - Formated print opening hours (string) in php -
in c there formatted print, allows formatted printing of numbers - aligning them. similar possible in php strings?
i have 2 strings $open_time
, $close_time
. example $open_time="12:00"
, $close_time="23:00"
.
desired output
12:00 - 23:00 7:00 - 20:00 12:30 - 1:00 5:00 - 6:00
output echo
12:00 - 23:00 7:00 - 20:00 12:30 - 1:00 5:00 - 6:00
see 12:00 5 characters, 7:00 4 characters? need add space. there function in php print mask in c (not sure if possible in c)
some_print("string_5_charactersspace-spacestring_5_characters", $open_time,$close_time);
where space mean space: "%string_5_characters - %string_5_characters"
.
my simple solution check if string has 5 chars , if not concatenate space 5 chars ... i'm curious if possible 1 function possible printing numbers in c.
Comments
Post a Comment