edujugon / core
一组有用的类和函数。
v1.0
2016-10-24 18:08 UTC
Requires
- php: >=5.5.0
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2024-09-19 10:13:05 UTC
README
一组有用的类和函数。
可用的类
日期
方法
getMonths
语法
getMonths
方法获取月份列表。您可以通过参数传递 lang、offset 和 length。
/** * Get months list. * * if lang is null, "en" language is set by default. * if offset is null return all items. * * If offset is non-negative, the sequence will start at that offset in the array. * If offset is negative, the sequence will start that far from the end of the array. * * If length is given and is positive, then the sequence will have up to that many elements in it. * If the array is shorter than the length, then only the available array elements will be present. * If length is given and is negative then the sequence will stop that many elements from the end of the array. * If it is omitted, then the sequence will have everything from offset up until the end of the array. * * @param $lang * @param null $offset * @param null $length * @return array|mixed */ array getMonths($lang = NULL, $offset = NULL, $length = NULL)
数量
方法
myList
语法
myList
方法获取数字数组。您必须传递起始数字和所需数组的长度。
/** * Get Array of numbers. * * If length is negative returns previous numbers * If length is positive returns following numbers * The total items of the array is the starting number parameter plus the length amount. * so if length value is 3 or -3 it will return an array of 4 items. * * @param $start * @param int $length * @return array */ array myList($start, $length = 0)
查找替换
方法
soft
语法
soft
方法在文本中用替换字符串替换搜索到的子串。
/** * Soft find&replace where do a strtolower either the find text and the text where search. * It's no case sensitive. Foo == foo * * @param $find * @param $replace * @param $text * @return mixed */ string static function soft($find, $replace, $text)
strict
语法
strict
方法在文本中用替换字符串替换搜索到的子串。
大小写敏感
/** * Strict find&replace it search for the exact substring($find) inside the text. * It's case sensitive Foo != foo * * @param $find * @param $replace * @param $text * @return mixed */ string static function strict($find, $replace, $text)