Bug #77386 [Opn->Nab]: The result is different than it should be.

From: Date: Mon, 31 Dec 2018 10:37:33 +0000
Subject: Bug #77386 [Opn->Nab]: The result is different than it should be.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218700@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77386&edit=1

 ID:                 77386
 Updated by:         peehaa@php.net
 Reported by:        maikcrew at centrum dot cz
 Summary:            The result is different than it should be.
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Debian
 PHP Version:        7.2.13
 Block user comment: N
 Private report:     N

 New Comment:

You are working with strpos which counts bytes. Use mb_strpos


Previous Comments:
------------------------------------------------------------------------
[2018-12-31 10:37:09] mega6382 at mega6382 dot me

You should use mb_strpos for this http://php.net/manual/en/function.mb-strpos.php

Because your string contains multibyte characters

Example: https://3v4l.org/epioV

------------------------------------------------------------------------
[2018-12-31 10:32:37] maikcrew at centrum dot cz

Description:
------------
---
From manual page: https://php.net/function.strpos
---


Test script:
---------------
<?php
  $řetězec = "\"Babylónská rybka,\" odříkával tiše
Stopařův průvodce po Galaxii";
  $pozice = strpos($řetězec, "rybka");
  echo "Hledané slovo začíná na pozici $pozice";
?>

Expected result:
----------------
pozice = 12 but php show 14 ? I study book. When I try count position manualy look that is 12.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77386&edit=1


Thread (4 messages)

« previous php.bugs (#218700) next »