Category: php functions

.

How to use substr_count()

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

The substring count php function is very useful when you need to find out if there are instances of a certain string within a string. It counts how many instances are found. If all you need to know is whether or not a certain string is, use an if() statement to check for a number higher than 0.

<?php


if ($cnt = substr_count('onetwo- test 6 yhnos','test')> 0){

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

}
Author: D.Shaun Morgan

rtrim See Also: rtrim() trim()

strip tags StripTags() php function Striptags() is a php function that literally strips HTML tags out of files that are streamed in to php with a function like

php functions php

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

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. <?php

.

 

Leave a Comment

substr_count

Name:      | Email:      | Website:

Comment:


captcha

Enter The Above Security Code: