Answers for "php to show number of characters in string"

PHP
3

how to count string characters in php

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

get number of chars ina string php

$name = "Perú"; // With accent mark
echo strlen($name); // Display 5, because "ú" require 2 bytes.

$name = "Peru"; // Without accent mark
echo strlen($name); // Display 4
Posted by: Guest on May-13-2020

Code answers related to "php to show number of characters in string"

Browse Popular Code Answers by Language