Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2009
    Location
    Newport Beach, California
    Posts
    96
    Thanks
    11
    Thanked 1 Time in 1 Post

    Most common string functions?

    Hi.

    Noticed there are many string functions. Too many for a newbie to learn.

    http://php.net/manual/en/ref.strings.php

    Which are most common?

    Which are worth learning?

    Where should I start?
    Last edited by PonchoX; 02-07-2010 at 04:24 PM.

  • #2
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Use them as you need them. You don't have to memorize any of it, always refer to the PHP manual.









    ------------------------------------
    Leonard Whistler

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    238
    Thanks
    3
    Thanked 37 Times in 37 Posts
    Len Whistler is absolutely right.

    Still if you are only starting to work with String functions, I think I would recommend to pay special attention to some functions/language constructs. I just browsed through the list of all String functions/language constructs for you and tried to extract the ones I use most often in my projects:

    echo
    trim()
    str_replace()
    htmlentities(), htmlspecialchars()
    explode()/implode()
    nl2br()
    substr()
    sprintf()
    strlen()
    strpos() - to check if some substring exists in a string - will return boolean false if it does not
    strtolower()/strtoupper()
    stripslashes() (I normally do not use its counterpart addslashes() because I usually work with MySQL where mysql_real_escape_string() is recommended instead).

    These in my experience I met in the projects most often. Other String functions are used too of course, but these I use constantly. This is in my experience only of course.

    Maybe this list is not complete but I would recommend to know at least these few by heart. For the other functions I would recommend to read the description carefully but not learn them by heart (just to know some functions for some particular functionality exist even if you do not remember the function name).

    Please notice that the PHP String functions are very powerful. And if you think some function could possibly exist for something, most probably it really exists. And it is a very good idea to check the Manual to see if there is a special function for a particular task you need. PHP has functions almost for anything which could be imagined

    Sorry if this post is not really helpful. I just remember I had the same feelings when I only started to learn PHP many years ago. So I hoped my thoughts in this matter could be possibly useful for you.
    Last edited by SKDevelopment; 02-06-2010 at 11:00 AM.

  • #4
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    If you are wanting to learn php I would highly recommend taking a look at http://www.phpvideotutorials.com/
    There are basic free lessons and paid courses that are very cheap (like $10) for a whole walkthrough of a website build. You can also subscribe for somthing silly like $30 and download ALL the courses, which is great value for money and even when your subscription runs out your downloaded videos still run
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #5
    New Coder
    Join Date
    Apr 2009
    Location
    Newport Beach, California
    Posts
    96
    Thanks
    11
    Thanked 1 Time in 1 Post
    Thank-you, kindly. Perfect. Just what I was looking for.

    I am using this vdo tute:

    http://www.lynda.com/home/DisplayCourse.aspx?lpk2=435
    Last edited by PonchoX; 02-07-2010 at 09:02 PM.


  •  

    Posting Permissions

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