PHP Classes

File: example1.php

Recommend this page to a friend!
  Classes of Valentin  >  IDStringUtils  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: example script
Class: IDStringUtils
Provide full capabilies for work with strings
Author: By
Last change: changes up to new version
Date: 13 years ago
Size: 1,569 bytes


Class file image Download
$strutils = new IDStringUtils();

//generate random string with only numbers
echo $strutils->RndStr(8,'n').'<br />';
//EX Output: 17112203

//generate random string with numbers and symbols
echo $strutils->RndStr(8,'bn').'<br />';
//EX Output: KX8FKane

//generate random string by mask
echo $strutils->MaskStr('aaAAnnvvVVccCCssSSrrRR').'<br />';
//EX Output: upGG74yoYUlsLC!-_!lO_5

//good pass example
echo $strutils->MaskStr('CvCvCvN').'<br />';
//EX Output: BoGoZy0

//or like this
echo $strutils->MaskStr('bbbbbb').'<br />';
//EX Output: yuMAXM

//fix broken url
echo $strutils->FixUrl('http://qwe.qwe/@#$%@#$%@#you all bastards! I"ll kill ya somday!!!').'<br />';
//EX Output: http://qwe.qwe/@#%24%25%40%23%24%25%40%23you%20all%20bastards%21%20I%22ll%20kill%20ya%20somday%21%21%21
//this function still doesn't work properly, so if you can help with it plz contact me!

//check type of entered data and length
echo $strutils->IsStrOk('34563456','num',3,10).'<br />'; //<--- is entered data number with length from 3 to 10
//EX Output: true
echo $strutils->IsStrOk('some text','log').'<br />'; //<--- is entered data login or pass, without checking length
//EX Output: false
//and so on...

// cut string
echo $strutils->Cut('VERY logn string! yeah!',10).'<br />';
//EX Output: VERY lo...

// makes string safe
echo $strutils->SafeStr('some string and also html <html></html> and php <?php code code ?>').'<br />';
//EX Output: some string and also html and php


For more information send a message to info at phpclasses dot org.