If the title confuses you, don’t fret. My tutorial will explain it to you. Strings, as we know in compu-speak is text. Well, if you want to get part of the text but not all of it, you can use substring. Then if you want to find the position of some text to use in the substring function , you can use the function for that to find the matches for what you put in. However, if there is no match it will default to 0.
Here are the sources used in this tutorial:
tut017.php
<?php //PHP Tutorial 017 $string = "We eat lots of bread and butter all day long with tacos!"; $search = "bread"; $pos = strpos($string, $search); $return = substr($string, $pos+strlen($search)); echo $return; ?>
December 11th, 2010 at 4:46 am
Thanks for some quality points there. I am kind of new to online , so I printed this off to put in my file, any better way to go about keeping track of it then printing?