Blog Details

how to get first four characters from string in PHP



                                

"; echo substr($x, 0, 4); //returns "wama" echo "
"; echo "
"; echo "Some other examples too.."; echo substr ($x, 0, 3); // outputs wam echo "
"; echo substr ($x, 1, 1); // outputs a echo "
"; echo substr ($x, -2); // outputs re echo "
"; echo substr ($x, 1); // outputs ama software echo "
"; echo substr ($x, -2, 1); // outputs r echo "
"; ?> output : wama software Some other examples too.. wama wam a re ama software r


Categories

Core_PHP

Latest posts

13.05.14
Implementing CRUD Operations ΒΆ

<ul> <li>Now comes the fun part. We would like t

13.05.14
View

<ol> <li><a href="http://www.yiiframework.com/do

13.05.14
Creating Model

<ol> <li><a href="http://www.yiiframework.com/do

Get Free Quote