With the substr() function i must enter where i want to cut the string by numbers, is there any way of cutting a string by passing words or characters?
Something like this:
<?php
$string = "Hey there world!";
magic_substr($string, "there ", "!");
// returns "world"
?>
Is there a function like that? If so, i've missed something pretty useful, as i've been searching the PHP documentation for a while now. I know i can figure out where to cut the string by using strpos(), but it'd be a lot easier and quicker to cut the string by passing a small part of the string defining where i want to cut it.
EDIT!
There might be smarter ways to do it, so here's what i'm actually trying to do:
$string = "21:0,19:0,20:0,18:0,17:0,25:0,30:0,23:0,31:0,32:0,33:0";
magic_substr($string, "20:", ",");
// returns "0" (i know all of them returns 0 now, but that'll change later)
Any suggestions? Thanks!