...

View Full Version : Resolved Most common string functions?



PonchoX
02-06-2010, 07:22 AM
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?

Len Whistler
02-06-2010, 08:46 AM
Use them as you need them. You don't have to memorize any of it, always refer to the PHP manual.









------------------------------------

SKDevelopment
02-06-2010, 11:53 AM
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.

JAY6390
02-06-2010, 12:17 PM
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

PonchoX
02-07-2010, 09:18 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum