DarkHavn Posted August 24, 2006 Share Posted August 24, 2006 Hey there, currently have a post that's gone quite hrmm how would you put it, out there. lolThe data it returns isArrayrandom (and the part i want is random), now substr is abit confusing so far, so how many numbers does it take to get to the letter r, and to delete everything preceeding (before) it?So the only resullt im left with is ''random'', just want to delete ''array'' from the value :( Link to comment https://forums.phpfreaks.com/topic/18591-substr-questions/ Share on other sites More sharing options...
SharkBait Posted August 24, 2006 Share Posted August 24, 2006 Think you need to look at strpos();That will tell you the position of the string then you could substr();[code]<?php$loc = strpos("y", "arrayrandom");$word = substr("arrayrandom", $loc, str_length("arrayrandom"));?>[/code]I think what that should do is set $loc to 5 then substr arrayrandom starting at position 5 (the "y") and go until end of the length of the rest of the string.If I am wrong, at least the general idea is there ;) Link to comment https://forums.phpfreaks.com/topic/18591-substr-questions/#findComment-80063 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.