Verbat Posted February 24, 2008 Share Posted February 24, 2008 If for example i have the word - TEST How can i get only the first 2 letters from it so i will have TE? Same with numbers please. Thanks. Link to comment https://forums.phpfreaks.com/topic/92693-part-of-a-word/ Share on other sites More sharing options...
toplay Posted February 24, 2008 Share Posted February 24, 2008 See substr() function examples in the manual at http://www.php.net Link to comment https://forums.phpfreaks.com/topic/92693-part-of-a-word/#findComment-474955 Share on other sites More sharing options...
Verbat Posted February 24, 2008 Author Share Posted February 24, 2008 Thanks..... Link to comment https://forums.phpfreaks.com/topic/92693-part-of-a-word/#findComment-474956 Share on other sites More sharing options...
Northern Flame Posted February 24, 2008 Share Posted February 24, 2008 or just do this: <?php $word = "TEST"; echo $word[0]; echo "\n<br>\n"; echo $word[1]; /* $word[0] displays the first character - T $word[1] displays the second character - E */ ?> Link to comment https://forums.phpfreaks.com/topic/92693-part-of-a-word/#findComment-474958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.