DevelopPHP
home Forum gear home

Libraries book

HTML Library CSS Library JavaScript Library PHP Library

Videosbook

PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous

Resourcesbook

Website Hosting
substr ( ) - Return a specified portion of a string   Share / Like
The substr() string function in PHP will return a part of a string according to the parameters you feed it. It can take up to three parameters. The first parameter is the string. The second parameter is the starting position in the string(can be a negative number to count from the end of the string if you like). The third parameter is the length of how many characters in the string that you wish to select and make a substring out of.

Learn HTML
<?php
$myString 
"Welcome to the circus";
$result1 substr($myString1);
$result2 substr($myString8);
$result3 substr($myString08);
$result4 substr($myString, -7);
$result5 substr($myString, -74);
echo 
$result1."<br />";
echo 
$result2."<br />";
echo 
$result3."<br />";
echo 
$result4."<br />";
echo 
$result5."<br />";
?>

Develop PHP browser display window
elcome to the circus
to the circus
Welcome 
circus
cir

Home   •   Terms of Use   •   Developer Forums   •   T-Shirts   •   RSS   •   Classroom Chalkboard   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties
©2013 DevelopPHP   |   Navigate to related domains HTML5