• PHP Video Tutorials

PHP - Function Substr



Syntax

string substr ( string $string , int $start [, int $length ] )

Definition and Usage

It used to return a part of a string

Return Values

It returns a part of string

Parameters

Sr.No Parameters & Description
1

string

It is used to specifies input string

2

start

It specifies start the string and count the string

3

length

It specifies length of a string

Example

Try out the following example

<?php
   echo substr("Sairam Krishna",6);
?>

This will produce following result −

Krishna
php_function_reference.htm
Advertisements