How to find the position of the first occurrence of a multi-byte substring in amulti-byte string in PHP

2 Answers

0 votes
$s = "לתכנות עדיין יצטרכו בני אדם בעתיד";

echo mb_strpos($s, ' אדם ');

// use only function that start with: 'mb_' ('mb_' prefix)

/*
run:

43 

*/

 



answered Aug 9, 2015 by avibootz
0 votes
$s = "לתכנות עדיין יצטרכו בני אדם בעתיד";

echo mb_strpos($s, ' אדם ', 0, 'UTF-8');

// use only function that start with: 'mb_' ('mb_' prefix)

/*
run:

23 

*/

 



answered Aug 10, 2015 by avibootz
...