PHP beginner to master Part 3: Strings and numbers

Hello guys,

In php tutorial  series we will now learn about the strings, Integer and float functions in PHP.
Strings :String concatenation:We can concatenate strings using the dot(.) operator.

For Example

<?php$first=”hello from techtwinklers “;$second=”presented by arumugam”;$third =$first;

echo $third .=$second;


Other Functions :
Output will be  as :  hello from techtwinklers presented by arumugam.

Change case to upper case : strtoupper($third);

Change case to lowercase : strtolower($third);

Change the first letter of the paragraph as capital letter : ucfirst($third);

Change each word’s first letter to uppercase : ucwords($third);

Find a string inside a string : strstr($third,”searching word”);

Remove unwanted spaces at beginning and at end : trim($third);

find the string postion : strpos($third,”by”);

Integer operations :

We can use short hand assignment operator in PHP also.

examples :

$b += $a; //Add the $a and $b and store it in the $b;

and also -=,*=,/= also available in php.

Increment and decrement operator:

++$b , –$b; Used to increment or decrement the integer values.


There are many functions available for float values such as

Round($variable) : change the float to nearest interger value.

ceil($varible) : change the float value in to nearest high value.

floor(variable) : Change the float value in to nearest low value.

pow(value1,value2) : Find the power of first value.

rand() : Used to generate Random values of intergers.

rand(start_range,end_range) : used to generate random values in the specified range.


If you have any doubt or need more explanation in php please comment below we will help you to solve your issue.

I'm a always needed to know whats happening in technology world. I believe that "Technology" is the only word which can able to change the world and which should be more used by normal people to do their things easier.

You may also like


Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!