php: shortcut to writing this?
Posted
by YuriKolovsky
on Stack Overflow
See other posts from Stack Overflow
or by YuriKolovsky
Published on 2010-04-12T11:24:04Z
Indexed on
2010/04/12
11:33 UTC
Read the original article
Hit count: 375
what would be the shortest way to write this?
if(strpos($haystack, $needle)!==false){
$len = strpos($haystack, $needle)+strlen($needle);
}else{
$len = 0;
}
I remember that I saw some shortcut somewhere for this that checked and set a variable at the same time.
© Stack Overflow or respective owner