Contact Number
Email Address

Uncategorized

Php 5 strings

PHP 5 Strings


A string is a sequence of characters, like “Hello world!”.


PHP String Functions

In this chapter we will look at some commonly used functions to manipulate strings.


Get The Length of a String

The PHP strlen() function returns the length of a string.

The example below returns the length of the string “Hello world!”:

Example

Php data types

PHP Data Types

Variables can store data of different types, and different data types can do different things.

PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers – also called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resour

Php echo/print

PHP echo and print Statements

echo and print are more or less the same. They are both used to output data to the screen.

The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print.