Category: php functions


How to use substr_count()

int substr_count ( string $haystack , string $needle [, int $offset= 0 [, int $length ]] )

substr_count ( string $haystack , string $needle [, int $offset= 0 [, int $length ]] )

Is a php function looks for instances of

A String Within a String.

It returns how many instances are found.

The example below is using a string called "tested_string".

A variable "$cnt" to catch the return value.

And the "if()" control to check for a number greater than 0.

if ($cnt = substr_count('tested_string','test')> 0){

echo "yes test is in there $cnt times";

Author: D.Shaun Morgan

str ireplace mixed str_ireplace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) N

die The die function Die('') is a very useful php function. You can place "die anywhere in a script that want that script to terminate. It also provides a bit of f

stripslashes How to use stripslashes <?php $exampleString = 'My\ex\ampl\e'; $charlist = 'ea';

ltrim ltrim ltrim() php function ltrim removes the leftmost entity from a string in PHP. " " (ASCII 32 (0x20) - space. "\t" (ASCII 9 (0x09)) - tab. "\n

echo echo Echo is used in php scripts to output html characters to the screen. echo is one of the most used functions in the php language.


Leave a Comment


Name:      | Email:      | Website:



Enter The Above Security Code: