本文整理汇总了PHP中_str_pad函数的典型用法代码示例。如果您正苦于以下问题:PHP _str_pad函数的具体用法?PHP _str_pad怎么用?PHP _str_pad使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_str_pad函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_pad
/**
* Pads a UTF-8 string to a certain length with another string.
* @see http://php.net/str_pad
*
* @author Harry Fuecks <hfuecks@gmail.com>
*
* @param string input string
* @param integer desired string length after padding
* @param string string to use as padding
* @param string padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH
* @return string
*/
public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
if (!isset(self::$called[__FUNCTION__])) {
require SYSPATH . 'core/utf8/' . __FUNCTION__ . EXT;
// Function has been called
self::$called[__FUNCTION__] = TRUE;
}
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
}
示例2: str_pad
public static function str_pad($str, $final_str_length, $pad_str = " ", $pad_type = STR_PAD_RIGHT)
{
if (!isset(UTF8::$called[__FUNCTION__])) {
require JsonApiApplication::find_file("utf8", __FUNCTION__);
// Function has been called
UTF8::$called[__FUNCTION__] = TRUE;
}
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
}
示例3: str_pad
/**
* Pads a UTF-8 string to a certain length with another string. This is a
* UTF8-aware version of [str_pad](http://php.net/str_pad).
*
* $str = UTF8::str_pad($str, $length);
*
* @author Harry Fuecks <hfuecks@gmail.com>
* @param string $str input string
* @param integer $final_str_length desired string length after padding
* @param string $pad_str string to use as padding
* @param string $pad_type padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH
* @return string
*/
public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
if (!isset(UTF8::$called[__FUNCTION__])) {
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
UTF8::$called[__FUNCTION__] = TRUE;
}
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
}
示例4: str_pad
/**
* Pads a UTF-8 string to a certain length with another string.
* @see http://php.net/str_pad
*
* @author Harry Fuecks <hfuecks@gmail.com>
*
* @param string input string
* @param integer desired string length after padding
* @param string string to use as padding
* @param string padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH
* @return string
*/
public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
require_once dirname(__FILE__) . '/' . __FUNCTION__ . '.php';
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
}
示例5: str_pad
/**
* Pads a UTF-8 string to a certain length with another string
*
* This is a UTF8-aware version of [str_pad](http://php.net/str_pad).
*
* Example:
* ~~~
* $str = UTF8::str_pad($str, $length);
* ~~~
*
* @author Harry Fuecks <hfuecks@gmail.com>
*
* @param string $str Input string
* @param integer $final_str_len Desired string length after padding
* @param string $pad_str String to use as padding [Optional]
* @param integer $pad_type Padding type: STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH [Optional]
*
* @return string
*
* @uses Kohana::find_file
*/
public static function str_pad($str, $final_str_len, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
UTF8::_load(__FUNCTION__);
return _str_pad($str, $final_str_len, $pad_str, $pad_type);
}