Results 1 to 1 of 1

Thread: Common Library

  1. #1
    Join Date
    Jun 2003
    Posts
    232

    Common Library

    I have created what I call a common library. A set of functions that is more of an extension of shortcuts and new functions that I think php should of included. I plan to add more later and plan to maintain this source. Go check out the documentation and see if anything is to your liking. Some of the functions are dependent on other functions that come in the package though so cutting and pasting some functions wotn work unless you cut and paste others. However this is under the bsd license so make sure you read that before you consider copying and pasting.

    I know this code is simple and that was my point. Simple well coded shortcuts and additions to php standard functions.

    Enough talk check out the doc and see if you like it.

    You can get it from
    http://www.charles-domain.com/
    and documentation is at
    http://www.charles-domain.com/Docs/

    EDIT README removed due to a patch. You will just have to use the documentation at http://www.charles-domain.com/Docs/

    EDIT AGAIN:
    I just fixed bugs and added features I should of added before posting this. And now I have time to write a proper summary of what my code is. I originally had one but due to modifications I removed the read me.

    here is the list of functions

    //cleans both arrays and variables by adding \
    clean
    //converts arrays to objects objects to arrays windows style dirs to unix style
    //strings to ints and ints to strings
    convert
    //displays the first character of a string or first element of an array
    //this will be it will be so useful and make code so much cleaner
    first
    //if the first character is whatever you specify or first element of an array is
    //what you specify then it returns true
    first_match
    //same as the above but if there is a match the first character or element
    //is deleted
    first_match_remove
    //removes the first character of any string and first element of an array
    first_remove
    //same as any normal hash but if mhash is installed it will use that
    //otherwise it will use md5 it also has the option of using a key
    //when mhash is installed
    hash_md5
    //all of these are the opposite of the above functions with the prefix of first
    last
    last_match
    last_match_remove
    last_remove
    //len returns the length of both variables and
    //one function to rule them all)
    len
    //prefixes a string
    prefix
    //same as print_r but its got added <pre></pre> tags
    printr
    //reverses both strings and arrays
    rev
    //adds a suffix to a string
    suffix
    //One_NUM-TwO will be converted to One Num Two
    title
    //returns the type of anything input in string format great for debugging
    type

    I tried to keep things simple these are things i needed for myself but i think they are generic enough to share. I will write a c extension of these when I have the time and lean a bit more c.

    If anyone has anymore ideas for useful dynamic functions and shortcuts just let me know and ill add them. There is more I could of added but I need something to trigger my memory.

    It is simple, and the reason for that is I would be using classes if it was not simple. If you have any comments feel free to leave them.

    Also if you read this post earlier you might of download a copy that was buggy as I realized I had to fix a lot of stuff and add a bit of extra functionality.
    [quote]
    Last edited by Nameless344; 11-14-2006 at 04:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •