Answers for "count of characters in string php"

PHP
3

php count specific characters in string

<?php
//you can use the substr_count function
$str = "this is a test string"; 

echo substr_count($str, "s");  //Output: 4
?>
Posted by: Guest on May-23-2021
3

how to count string characters in php

<?php
$str1 = 'Hello world!';
echo strlen($str1); // Outputs: 12
Posted by: Guest on June-27-2021
11

string length php

<?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7
?>
Posted by: Guest on February-12-2020

Code answers related to "count of characters in string php"

Browse Popular Code Answers by Language