Logic Matters Free Video Tutorials

PHP Video Tutorial Part 3 [concatenation,string functions,php operators]

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...

Hi guys,

PHP Video Tutorial Part 3

Part 3: Documentation + Video Avi Format [Concatenation,String Functions,PHP Operators]

Watch PHP tutorial Part 3.1:

YouTube Preview Image

Watch PHP tutorial Part 3.2:

YouTube Preview Image


Documentation

Hello Friends,

Welcome To PHP Tutorial Part 3

_____________________________________________________________________________________________

So Let’s Start the Tutorial Part 3:

So today we start CONCATENATION operators:

The concatenation operator is used to combine the two strings values together.We use(.) i.e. as a concatenation operator. You are more clear about this when we write program

<?php

$cat1=” 1st string concatenate”; // this is our 1st string

$cat2=” with 2nd string”; // here 2nd one we concatenate these two in next inst.

echo $cat1 . ” ” . $cat2;

?>

Another method to combine is:

<?php

echo “$cat1  here it goes </br>”; // another method

echo”{$cat1} here it goes </br>”; // prefer this one

echo’{$cat1} here it goes </br>’; // never put single comma

?>

If you want to use 2nd one then prefer the curly brackets it easy to identify if we want to check our coding later on!So all these are working one you can use any of them.

If you put single comma then this will not work. You see it will display text as such so use only double commas. Check the last instruction in the upper program.


Our next topic String Functions:

How to find the length of string? strlen() function is used to find the length of string. let’s suppose I want to find the length of string “I m a big noob”

<?php

echo strlen(“i m a big noob”);

?>

It starts count from 1 not from 0. This concept is important when we want to terminate the loop after the last character .There are some other functions also like to find the position of string. For this we use strpos() to search for a string or character in a string.

<?php

echo strpos(“i m a big noob”, “noob”); // this will find the position of string of noob in the given string

?>

You see the position of “noob” is 11 not 10 this means our function strpos() starts form 0 i.e. why answer is 10 not 11.

There are so many such functions let me show in breif:)

Lowercase:                                        strtolower()

Upercase:                                          strtoupper()

Upper case first letter:                  ucfirst()

Upper case words:                          ucwords()

Trim:                                                      trim()

Find:                                                      strstr()

Replace by string:                            str_replace()

Repeat:                                                 str_repeat()

Make substring:                                substr()

Find char:                                            strchr()

So these are some common function. Search on net for these.

Now lets take a look on PHP operators :

I just show overview it’s easy to use :) All these operators are having examples and description and result too. So its easy to understand.

php operators

Hope you enjoying the tutorial.

Thanks for reading this documentation.   


Thanks,

LM Team!

If you like it, then why not share with others and bookmark it :

  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogosphere News
  • email
  • Internetmedia
  • LinkedIn
  • Live
  • MSN Reporter
  • MySpace
  • PDF
  • SphereIt
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • RSS
  • blogmarks