martes, 21 de junio de 2016

substr

substr

(PHP 4, PHP 5, PHP 7)
substr — Return part of a string

Description ¶

string substr ( string $string , int $start [, int $length ] )
Returns the portion of string specified by the start and length parameters.

Parameters ¶

string
The input string. Must be one character or longer.
start
If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.
If start is negative, the returned string will start at the start'th character from the end of string.
If string is less than start characters long, FALSE will be returned.
Example #1 Using a negative start
<?php
echo  substr ("abcde" , 0,3 );
?>
retrun abc




No hay comentarios:

Publicar un comentario