chronoscript();
echo $numericalclock1->displayclock();
?>
About the String Foreach class
Stringforeach class is a usefull 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 the manipulation like
search, replacement, deletion,explosion,case transformation .
About the String Foreach class methods
class Stringforeach{
protected $str, $length;
public function __construct($string){
the constructor
}
public function explodemore ($separate=''){
can be used to explode the string in array
$separate can be chosen in this set of values {word,ponctuation,phrase} or any string or even a numeric
when $separate is a numeric the string is split in array of string of which the length is equal to the chosen numeric
when $separate is a string==word the string will be split in array of words
when $separate is is a string==ponctuation the string will be split before ponctuation in array of string
when $separate is a string==phrase the string will be split in array of phrases.
when $separate is a string=="" the string will be split in array before any space type character
when $separate is just any other string, the method will just act like the function explode of PHP.
}
}
public function strforeach(){
can be used to explode the string in array of characters
}
public function strposall($s){
can be used to find all the occurences of the string $s and their precise position in the string
}
public function strposreplace($s,$s2,$pos){
can be used to replace the occurence of the string $s in the position $pos by the given string $s2
}
public function strposadd($s,$s2,$pos,$before=true){
can be used to add $before or after the occurence of the string $s in the position $pos , the given string $s2
}
public function addstratpos($s,$pos,$before=true){
can be used to add $before or after the position $pos , the given string $s
}
public function upper_1stletter(){
can be used to upper the first letter of all the phrases contained in the string
}
public function upper_pos($pos){
can be used to upper the letter in the position $pos in the string
}
public function lower_pos($pos){
can be used to lower the letter in the position $pos in the string
}
public function upper_strpos($s,$pos){
can be used to upper the occurence of the string $s in the position $pos in the string
}
public function lower_strpos($s,$pos){
can be used to lower the occurence of the string $s in the position $pos in the string
}
public function upper_preciseletter($s){
can be used to upper all the occurences of the letter $s in the string
}
public function lower_preciseletter($s){
can be used to lower all the occurences of the letter $s in the string
}
public function delete_posletter($s,$pos){
can be used to delete the occurence of the letter $s in the position $pos in the string
}
public function delete_pos($pos){
can be used to delete the character in the position $pos in the string
}
public function delete_preciseletter($s){
can be used to delete all the occurences of the letter $s in the string
}
public function delete_strpos($s,$pos){
can be used to delete the occurence of the string $s in the position $pos in the string
}
public function delete_strelements($offset,$length){
can be used to delete some string's elements by specifying the starting point $offset and the $length to specify the precise number
of characters to delete
}
public function delete_last(){
can be used to delete the last character in the string
}
public function delete_first(){
can be used to delete the first character in the string
}
public function wordmatches($pattern){
can be used to control if the given pattern is in the string
$pattern must use the pcre language
}
public function patternsmatches($patterns){
can be used to control if the given $patterns in array are in the string
$patterns must be an array of which each value use the pcre language
}
public function wordmatchespos($pattern){
can be used to find all the occurences and the postions of the given pattern in the string
$pattern must use the pcre language
}
public function patternsmatchespos($patterns){
can be used to find all the occurences and the postions of each given pattern in the array of $patterns in the string
$patterns must be an array of which each value use the pcre language
}
public function len(){
return the string length
}
public function numberdetect($lan='php'){
return the first occurence of special format number in the string and its offset
$lan is used to specify if the numbers in the string are in french format with a comma instead of point for float number
(example: 25.000,025)
or if numbers are in english format (example: 25,000.025) or simply in PHP format (example: 25000.025)
}
public function allnumberdetect($lan){
return all the occurences of special format number in the string and their offset
$lan is used to specify if the numbers in the string are in french format with a comma instead of point for float number
(example: 25.000,025)
or if numbers are in english format (example: 25,000.025) or simply in PHP format (example: 25000.025)
}
}
for some examples of use see the teststrforeach.php script file
bug reporting qnd feeback to leizmo@gmail.com or just use the dedicated forum of the package.