Пример #1
0
<?php

$t = new \org\rhaco\flow\module\Helper();
eq("00005", $t->zerofill(5, 5));
eq("5", $t->zerofill(5));
Пример #2
0
<?php

$t = new \org\rhaco\flow\module\Helper();
eq('on', $t->cond_switch(true, 'on', 'off'));
eq('off', $t->cond_switch(false, 'on', 'off'));
eq('off', $t->cond_switch('', 'on', 'off'));
eq('off', $t->cond_switch(0, 'on', 'off'));
eq('off', $t->cond_switch(false, 'on', 'off'));
eq('off', $t->cond_switch(array(), 'on', 'off'));
eq('on', $t->cond_switch('1', 'on', 'off'));
eq('on', $t->cond_switch(1, 'on', 'off'));
eq('on', $t->cond_switch(true, 'on', 'off'));
eq('on', $t->cond_switch(array(1), 'on', 'off'));
Пример #3
0
<?php

$t = new \org\rhaco\flow\module\Helper();
eq("a bc    d ef  g ", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>"));
eq("abcdefg", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>", ""));
eq("a-bc----d-ef--g-", $t->one_liner("a\nbc\r\n\r\n\n\rd<br>ef<br /><br />g<br>", "-"));
Пример #4
0
<?php

$t = new \org\rhaco\flow\module\Helper();
$str = "あいうえお12345かきくけこ";
eq("あいう", $t->trim_width($str, 7));
$t = new \org\rhaco\flow\module\Helper();
$str = "あいうえお12345かきくけこ";
eq("あいう...", $t->trim_width($str, 7, "..."));
$t = new \org\rhaco\flow\module\Helper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお123...", $t->trim_width($str, 13, "..."));
$t = new \org\rhaco\flow\module\Helper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお12345かきくけこ", $t->trim_width($str, 50, "..."));
$t = new \org\rhaco\flow\module\Helper();
$str = "あいうえお12345かきくけこ";
eq("あいうえお12345かきくけこ", $t->trim_width($str, 30, "..."));
Пример #5
0
<?php

$t = new \org\rhaco\flow\module\Helper();
$time = time();
eq(date("YmdHis", $time), $t->df("YmdHis", $time));
Пример #6
0
<?php

$t = new \org\rhaco\flow\module\Helper();
eq("123,456,789", $t->number_format("123456789"));
eq("123,456,789.020", $t->number_format("123456789.02", 3));
eq("123,456,789", $t->number_format("123456789.02"));