php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32885 Miscalulcating string length
Submitted: 2005-04-29 08:35 UTC Modified: 2005-04-29 08:46 UTC
From: homework at aofrozencity dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.9 OS: Windows 2003 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: homework at aofrozencity dot com
New email:
PHP Version: OS:

 

 [2005-04-29 08:35 UTC] homework at aofrozencity dot com
Description:
------------
'pictures' should be 8 string length. Thought, I got the result. It said that 'pictures' is 13 string length. It isn't correct. I notice that I use different words. It shows that string length is added with 5 practically. You can see that 8 (pcitures) length + 5 add length = 13 string length. I don't know why it is.

Reproduce code:
---------------
function word_match($a=null,$b=null)
			{
					print("Orginal A: $a<br>");
					$a_length = strlen($a);
					$b_length = strlen($b);
					$search = true;
					$length = 0;
					while($search)
						{
							if(substr($b,$length,$a_length)==$a)
								{
									$search = false;
									$result = true;
								}elseif($length>$b_length){
									print("<b>Websatellite: A: $a B: $b ($length>$b_length)</b>");
									$result = false;
									$search = false;
								}
							print("<b><br>Websatellite: ($a_length) ".substr($b,$length,$a_length)."==$a</b>");
							$length++;
						}
					return $result;
			}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-29 08:46 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC