PHP String handling functions

PHP String handling functions

we have a lot of php predefined constants for string handling. lets have a look on few of them

  1. strlen()
    this function was used to find the length of the string.
    Syntax: strlen(variable name)
  2. str_replace()
    used to replace a part of string with another string.
    Syntax: str_replace(search,replace,[number of replaces])
  3. str_ireplace()
    It was same as str_replace but it was case sensitive.
    Syntax: str_replace(search,replace,[number of replaces])
  4. trim()
    it was used to remove the empty space on both sides of a string
    Syntax: trim(variable name)
  5. strrev()
    It is used to reverse the string
    Syntax: strrev(variable name)
  6. strstr()
    it is used to search the first occurrence of string inside another string.
    Syntax: strstr(search, replace)
  7. stristr()
    same as strstr() but it was case sensitive.
    Syntax: strstr(search, replace)
  8. nl2br()
    Used to add line breaks (<br>) inside a string in place of  \n or \r
  9. str_split()
    used to split the string into an array
    Syntax: str-split(string [,length])
    lenghth is an optional, each character is stored as an array element default is 1.
  10. substr()
    used to collecting a part of String.
    syntax: substr(string, start index,[length])
  11. substr_count()
    for count occurrence of substring in main string
    syntax: str_count(string,substring,[start position],[length])
  12. str_repeat()
  13. used to repeating a string number of times.
    syntax: str-repeat(string, repeat count)
  14. strtolower()
    convert the string into lower case of alphabet.
    syntax: strtolower(string)
  15. strtoupper()
    convert the string into upper case of alphabet.
    syntax: strtoupper(string)
  16. strcasecmp()
    it was used to case insensitive comparison. this function returns “0” if both strings are equal otherwise it will return the numerical difference between first non matching characters.
    The value wil be +ve or -ve
    syntax:  strcasecmp(string1,string2)
  17. strcmp
    It was same as strcasecmp but it was case sensitive.
    it will return 0 if both are equal
    it will return 1 if string1>string2
    it will return -1 if string1<string2
  18. str_pad()
    it was used to add extra padding with specified length to the string.
    Syntax: str_pad(string,length,[pad string][pad_type])
    where PAD_TYPE is a constant of php it will be either of the php
    STR_PAD_LEFT(0)
    STR_PAD_RIGHT(1)
    STR_PAD_BOTH(2)
Example :

more string functions…

Benefits and Limitations of WordPress

Benefits and Limitations of WordPress

Everyone wants to blog and with a host of popular free blog hosting solutions available, WordPress.com is a popular choice. However, everything that comes free has its limitations, and it is better to know the benefits and limitations before starting a WordPress.com blog.

With WordPress.com Blogs

First I will highlight the major limitations of the WordPress Blogs which might make you decide to install the downloadable version (wordpress.org) with your own paid domain name and own webhosting.

Disadvantages

  • No income – with hosted WordPress you cannot monetize your blog. All the advertisements are controlled and you are not allowed to display advertisements
  • Domain limitation – your domain will be like this: www.yourblogname.wordpress.com
  • Limited storage space – if you run out of space you will need
  • Limited Design – you will get to choose from themes, but you cant upload and edit
  • Check terms and conditions

 

Advantages

  • Free – you don’t have to pay for hosting and domain registration. All you need is an e-mail address.
  • Automatic Updates – Each time the new version becomes available, your blog will be automatically updated.
  • Easy to Use and Set-up – All you need to do is to create a WordPress account, choose your subdomain, theme and you are ready to go

With your Self hosted Blogs

A WordPress Blog that is hosted through your own domain ensures that your site is not only completely optimised for search engine ranking, but also provides the highest level of customisation and options to earn revenue.

With self hosted blog you gain more power and control of your own blog.

Advantages

  • Earn revenue – start selling your own products or promoting someone else’s products. You are allowed to add a shopping cart and any number of plug-ins for tracking, click-throughs, and other widgets that generate revenue.
  • Design – No limitation on themes. There are many free themes available and also customised or premium themes to make it more profesional.
  • Complete control – you can customise your blog/website as you wish. No limitation on the design. This will help you to differentiate your blog from others. You will have many more options as your online business evolves and grows.
  • Search Engine Optimisation – WordPress is Search Engine friendly and allows every single page to be indexed.
  • Own Domain Name – choose the right name for your blog/website, get recognised, brand yourself. Do your keywords research first.

Disadvantages

  • Not as easy to set up – you will need to download and install WordPress. This also depend on the type of Hosting you use.
  • Not automatically updated – WordPress is becoming more and more popular and it is updated regularly and so you will need to manually update the self-hosted blog with the new release
  • Cost – you will have to pay for hosting and domain renewal. With the professional blog, or if you wish to use it as a Website, you will need a professional to design you a unique theme.