Add tags

Add tags to the following comment
マルチバイト非対応。

ex)
echo sprintf('<pre>[%s]</pre>', Centering('test', 4));

('test', 4) => [test]
('test', 8) => [  test  ]
('test', 5) => [test ]
('test', 2) => [es]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<?php
function Centering($str, $width)
{
    $slen = strlen($str);
    if ($slen < $width) {
        $str = str_pad($str, $width, ' ', STR_PAD_BOTH);
    } else {
        $str = substr($str, (int)(($slen - $width)/2), $width);
    }
    return $str;
}
?>

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...