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

file get contents file_get_contents PHP Function file_get_contents() streams in the content of a files that is passed to it as an argument.<?php

addslashes string addcslashes(string $str , string $charlist) How to use addslashes<?php $SlashedStri

nl2br nl2br() - How to convert newline characters to line breaks HTML To preserve the layout of characters type into a text-box and format it to display in an HTML

implode how to use implode() php function The implode() php function is exactly the opposite of explode(). It takes an array of strings

explode explode(); The explode(); php function is one that is used a lot. For example, you might want to read website content into a php script and then parse and manipu


Leave a Comment


Name:      | Email:      | Website:



Enter The Above Security Code: