2. PHP – Data Types/String Functions


PHP supports various data types.

1. Integers : All natural numbers.


2. Floating point numbers : Fractional values.


3. Boolean : Boolean value can be either true or false.


4. Null : Null value specifies that the variable has no value.


5. Array : We can store multiple values using the array. Array values can be mixed, meaning, it can have integer value, floating point numbers, or strings.

$x= array(“Hello”, 2, 3.5);

6. String.


Let us test these data types. Instead of using echo to print the values, let us use something called, var_dump. This prints both the data type as well as the value.

==>String Functions.

1. strlen() – Returns the length of the provided string.

echo strlen(“this line”);

2. strpos() – Returns the position of the character in the string or the stating position of the text in the string.

echo strpos(“lazy dog”,”dog”);

View original post


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s