Post
Simple substring-before function in php
function substring_before($haystack, $needle) { if ($i=stripos($haystack, $needle)) {// Needle found, return from start to needle return(substr($haystack, 0, $i)); } else {// Needle not found return $haystack; } }
Really need an explanation ?