Home / PHP Tips Generated By ChatGPT / Calculating the Length of a String in PHP Get the number of characters in a string with strlen(). Source Code $string = "Hello World"; echo strlen($string); // Outputs: 11