PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of zinsou A.A.E.Moïse   PHP String Foreach   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: readme
Class: PHP String Foreach
Process strings as arrays of characters
Author: By
Last change: add changes about the new version
Date: 6 years ago
Size: 10,117 bytes
 

Contents

Class file image Download
This package contains a class which allows to handle strings as arrays of characters while keeping the ability to be treated as a simple string,it is a useful way to handle some actions over the string type of PHP. It allows user to look and go trough a string just like an array and then make easier manipulations like search, replacement, deletion,explosion,case transformation. Most of the implemented methods are chain-able. Example: $Chars= new Chars (' hail mary 2pac amaru shakur >> 1'); echo $Chars->trim() ->sub_stri_position_add('a','po',3,false) ->stri_position_replace('A','',2) ->delete_last() ->delete_first() ->str_position_toupper('a',2) ->str_position_add('a',3); Although the fact that most of common functions are implemented as methods this class is specially useful to chain operations or to access the string as arrays or the best part, use foreach loop on the string easily.You can avoid method and directly use common functions waiting strings as parameters on the object just as a simple PHP string. Examples : preg_match('#shakur#',$Chars); $auth =chars("24\tLewis Carroll"); $n = sscanf($auth, "%d\t%s %s", $id, $first, $last); echo "<author id='$id'> <firstname>$first</firstname> <surname>$last</surname> </author>\n"; The class handle multibytes strings too. Class [ class Chars implements Countable, Iterator, Traversable, ArrayAccess, JsonSerializable ] { - Constants [0] { } - Static properties [0] { } - Properties [1] { Property [ private $chars=array() ] } - Static methods [6] { private static allnumberdetect(Parameter #0 [ <required> $str ]) private static isPcrePattern(Parameter #0 [ <required> $pattern ]) private static numberdetect(Parameter #0 [ <required> $str ]) protected static split(Parameter #0 [ <required> $string ]) public static __callStatic(Parameter #0 [ <required> $name ],Parameter #1 [ <required> $arguments ]) public static __set_state(Parameter #0 [ <required> $array ]) } - Methods [118] { public addcslashes() public addslashes() public bin2hex() public concat(Parameter #0 [ <required> $string ],Parameter #1 [ <optional> $side = 1 ]) public convert_cyr_string() public convert_uudecode() public convert_uuencode() public count() public count_chars(Parameter #0 [ <optional> $mode = 0 ]) public count_UnicodeChars(Parameter #0 [ <optional> $mode = 0 ]) public crc32(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> &$crc32 = NULL ]) public crypt(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> $salt = '' ],Parameter #2 [ <optional> &$crypt = NULL ]) public current() public c_rot(Parameter #0 [ <required> $r ]) public delete_first() public delete_last() public end() public explode(Parameter #0 [ <optional> $separate = NULL ]) public fprintf(Parameter #0 [ <required> $handle ]) public get() public getAndChain(Parameter #0 [ <required> &$chars ]) public hebrev() public hebrevc() public hex2bin() public htmlspecialchars() public htmlspecialchars_decode() public html_entities() public html_entity_decode() public intervertTwoCharsPos() public jsonSerialize() public key() public lcfirst() public LiftUpToPush(Parameter #0 [ <required> $value ]) public lower_pos(Parameter #0 [ <required> $pos ]) public ltrim(Parameter #0 [ <optional> $charlist = " \t\n\r\0\x0B" ]) public md5(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> &$md5 = NULL ]) public metaphone(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> $phone = 0 ],Parameter #2 [ <optional> &$metaphone = NULL ]) public money_format(Parameter #0 [ <required> $number ]) public next() public nl2br() public number_format(Parameter #0 [ <optional> $decimals = 0 ],Parameter #1 [ <optional> $dec_point = '.' ],Parameter #2 [ <optional> $thousands_sep = ',' ]) public offsetExists(Parameter #0 [ <required> $offset ]) public offsetGet(Parameter #0 [ <required> $offset ]) public offsetSet(Parameter #0 [ <required> $offset ],Parameter #1 [ <required> $value ]) public offsetUnset(Parameter #0 [ <required> $offset ]) public preg_replace(Parameter #0 [ <required> $pattern ],Parameter #1 [ <required> $replacement ],Parameter #2 [ <required> $limit ],Parameter #3 [ <required> &$count ]) public prev() public printf() public quoted_printable_decode() public quoted_printable_encode() public quotemeta() public rewind() public rtrim(Parameter #0 [ <optional> $charlist = " \t\n\r\0\x0B" ]) public sha1(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> &$sha1 = NULL ]) public show(Parameter #0 [ <optional> $concat = '' ]) public soundex(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> &$soundex = NULL ]) public sprintf() public strcspn(Parameter #0 [ <required> $mask ],Parameter #1 [ <optional> $start = 0 ],Parameter #2 [ <optional> $length = NULL ]) public stripcslashes() public stripos(Parameter #0 [ <required> $str ],Parameter #1 [ <optional> &$stripos = false ]) public stripslashes() public strip_tags(Parameter #0 [ <optional> $tags = '' ]) public stristr(Parameter #0 [ <required> $needle ],Parameter #1 [ <optional> $beforeneedle = false ]) public stri_position_all(Parameter #0 [ <optional> $str = ' ' ],Parameter #1 [ <optional> &$find = false ]) public stri_position_replace(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $s2 ],Parameter #2 [ <required> $pos ]) public stri_position_tolower(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $pos ]) public stri_position_toupper(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $pos ]) public strlen() public strpbrk(Parameter #0 [ <required> $charlist ]) public strpos(Parameter #0 [ <required> $str ],Parameter #1 [ <optional> &$strpos = false ]) public strrchr(Parameter #0 [ <required> $needle ]) public strrev() public strripos(Parameter #0 [ <required> $str ],Parameter #1 [ <optional> &$strripos = false ]) public strrpos(Parameter #0 [ <required> $str ],Parameter #1 [ <optional> &$strrpos = false ]) public strspn(Parameter #0 [ <required> $mask ],Parameter #1 [ <optional> $start = 0 ],Parameter #2 [ <optional> $length = NULL ]) public strstr(Parameter #0 [ <required> $needle ],Parameter #1 [ <optional> $beforeneedle = false ]) public strtolower() public strtoupper() public strtr() public str_getcsv(Parameter #0 [ <required> &$csv ],Parameter #1 [ <optional> $delimiter = ',' ],Parameter #2 [ <optional> $enclosure = '"' ],Parameter #3 [ <optional> $escape = '\' ]) public str_ireplace(Parameter #0 [ <required> $needle ],Parameter #1 [ <required> $replace ],Parameter #2 [ <optional> &$count = false ]) public str_pad(Parameter #0 [ <required> $pad_length ],Parameter #1 [ <required> $pad_string ],Parameter #2 [ <optional> $pad_type = 1 ]) public str_position_add(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $pos ],Parameter #2 [ <optional> $before = true ]) public str_position_all(Parameter #0 [ <optional> $str = ' ' ],Parameter #1 [ <optional> &$find = false ]) public str_position_replace(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $s2 ],Parameter #2 [ <required> $pos ]) public str_position_tolower(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $pos ]) public str_position_toupper(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $pos ]) public str_repeat(Parameter #0 [ <required> $multiplier ],Parameter #1 [ <optional> $mutate = true ],Parameter #2 [ <optional> &$result = '' ]) public str_replace(Parameter #0 [ <required> $needle ],Parameter #1 [ <required> $replace ],Parameter #2 [ <optional> &$count = false ]) public str_rot13(Parameter #0 [ <optional> $mutate = true ],Parameter #1 [ <optional> &$str_rot13 = NULL ]) public str_shuffle() public substr(Parameter #0 [ <required> $start ],Parameter #1 [ <optional> $length = NULL ]) public substr_compare(Parameter #0 [ <required> $string ],Parameter #1 [ <optional> $offset = 0 ],Parameter #2 [ <optional> $length = NULL ],Parameter #3 [ <optional> $case_insensitive = false ]) public substr_count(Parameter #0 [ <required> $needle ],Parameter #1 [ <optional> $offset = 0 ],Parameter #2 [ <optional> $length = NULL ]) public substr_replace(Parameter #0 [ <required> $replacement ],Parameter #1 [ <optional> $start = 0 ],Parameter #2 [ <optional> $length = NULL ]) public sub_stri_position_add(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $s2 ],Parameter #2 [ <required> $pos ],Parameter #3 [ <optional> $before = true ]) public sub_stri_tolower(Parameter #0 [ <required> $str ]) public sub_stri_toupper(Parameter #0 [ <required> $str ]) public sub_str_position_add(Parameter #0 [ <required> $s ],Parameter #1 [ <required> $s2 ],Parameter #2 [ <required> $pos ],Parameter #3 [ <optional> $before = true ]) public sub_str_tolower(Parameter #0 [ <required> $str ]) public sub_str_toupper(Parameter #0 [ <required> $str ]) public trim(Parameter #0 [ <optional> $charlist = " \t\n\r\0\x0B" ]) public ucfirst() public ucwords() public upper_sentence_start() public upper_string_position(Parameter #0 [ <required> $pos ]) public valid() public vfprintf(Parameter #0 [ <required> $handle ],Parameter #1 [ <required> $arguments ]) public vprintf(Parameter #0 [ <required> $arguments ]) public vsprintf(Parameter #0 [ <required> $arguments ]) public wordwrap(Parameter #0 [ <optional> $width = 75 ],Parameter #1 [ <optional> $break = '\n' ],Parameter #2 [ <optional> $cut = false ]) public __call(Parameter #0 [ <required> $name ],Parameter #1 [ <required> $arguments ]) public __construct(Parameter #0 [ <required> $string ]) public __debugInfo() public __get(Parameter #0 [ <required> $name ]) public __invoke(Parameter #0 [ <required> $arguments ]) public __set(Parameter #0 [ <required> $name ],Parameter #1 [ <required> $value ]) public __toString() } }