PHP Salt


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

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (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