note 8944 added to String functions

From: Date: Sat, 07 Oct 2000 22:29:36 +0000
Subject: note 8944 added to String functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-6206@lists.php.net to get a copy of this message
count a number of specific characteres in string. use str_count("a", "asda"); function str_count ($arg, $chr) { for ($x=0; $x <= strlen($arg); $x++) { if (substr($arg, $x, 1) == $chr) { $count++; } } return $count; } http://www.php.net/manual/ref.strings.php

« previous php.notes (#6206) next »