How to Compare String length in PHP?

General discussion on PHP
Post Reply
ashi4275
Posts: 15
Joined: Fri Jul 15, 2016 10:02 am

How to Compare String length in PHP?

Post by ashi4275 » Fri Nov 18, 2016 10:44 am

Hi, I am a developer. I have been searching for best suited developer forum which provide helpful information on php development, so that I can get help from its active members to get good learning on how to compare string length in php programming. I have searched alot of forums but didn't get the fruitful answer. I am hoping to get my query resolved and also looking to get informative links of such more forums.

User avatar
zvika
Zend Global Support
Posts: 994
Joined: Sun Dec 14, 2008 9:48 am
Contact:

Re: How to Compare String length in PHP?

Post by zvika » Tue Nov 22, 2016 8:21 am

Have you tried a Google search for "How to Compare String length in PHP?"
Zvika Dror
Zend Support Team

eva3688
Posts: 1
Joined: Wed Dec 07, 2016 9:02 am

Re: How to Compare String length in PHP?

Post by eva3688 » Wed Dec 07, 2016 9:12 am

How to tally the length of a PHP string? This capacity is required to check some shape approval likewise where any info field is entered clear. PHP work strlen does this work for us and returns number of characters inside the string including clear space. On the off chance that you need clear space to be evacuated then you can apply string supplant work str_replace to the string before applying strlen.

judy6640
Posts: 8
Joined: Sat Jun 17, 2017 10:07 am

Re: How to Compare String length in PHP?

Post by judy6640 » Sat Jun 17, 2017 10:24 am

ashi4275 wrote:Hi, I am a developer. I have been searching for best suited developer forum which provide helpful information on php development, so that I can get help from its active members to get good learning on how to compare string length in php programming. I have searched alot of forums but didn't get the fruitful answer. I am hoping to get my query resolved and also looking to get informative links of such more forums.
Int strcmp (string str1, string str2)
This function compares the two strings character-by-character (more precisely) and returns:

0 - if the lines completely match;

-1 - if string str1 is lexicographically smaller than str2;

1 - if, conversely, str1 "is greater than" str2.

Post Reply