PHP Salt


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

Version: 2.30.2
Last Build: September 02, 2021 09:55am (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
web
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:

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