gple Posted June 26, 2007 Share Posted June 26, 2007 If I have a word such as (c_text) in a variable $p. How do I output just text. I know to use the substring function but the text will vary and the amount of characters will vary. Link to comment https://forums.phpfreaks.com/topic/57247-viewing-characters/ Share on other sites More sharing options...
obsidian Posted June 26, 2007 Share Posted June 26, 2007 Try this: <?php $string = 'c_text'; for ($i = 0; $i < strlen($string); $i++) { echo $string{$i} . "<br />\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/57247-viewing-characters/#findComment-282942 Share on other sites More sharing options...
suma237 Posted June 26, 2007 Share Posted June 26, 2007 use explode function $s=explode("_",$p); Link to comment https://forums.phpfreaks.com/topic/57247-viewing-characters/#findComment-282943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.