PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.20.2
Last Build: October 16, 2017 12:40pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
file
graph
html
mail
math
misc
mobile
script
string
system
time
psStrAfter()
Returns everthing after an item


Description:

Pass this a string and a need (item to look for) and it will return
everything after it.
This works good for domain names too, such as www.somesite.co.uk


Usage:

$str = psStrAfter($needle,$haystack[,$trim]);

use $trim as TRUE or FALSE if you want to trim the result, default is false


Example:


$str = psStrAfter(".","www.somesite.co.uk"); // returns "somesite.co.uk"
$str = psStrAfter("user:","user: John Doe",true); // returns "John Doe"




Code:

function psStrAfter($needle,$haystack,$trim=false)
{
$str = substr($haystack,strpos($haystack,$needle)+strlen($needle));
if ($trim == true) { $str = trim($str); }
return $str;
}

Changlelog:


See Also

And a shot out to:

LinuxSimple - www.linuxsimple.com
PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site