1--TEST-- 2Test mb_strripos() function : basic functionality 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7/* 8 * Test basic functionality of mb_strripos with ASCII and multibyte characters 9 */ 10 11echo "*** Testing mb_strripos() : basic functionality***\n"; 12 13mb_internal_encoding('UTF-8'); 14 15//ascii strings 16$ascii_haystacks = array( 17 'abc defabc def', 18 'ABC DEFABC DEF', 19 'Abc dEFaBC Def', 20); 21 22$ascii_needles = array( 23 // 4 good ones 24 'DE', 25 'de', 26 'De', 27 'dE', 28); 29 30//greek strings in UTF-8 31$greek_lower = base64_decode('zrrOu868zr3Ovs6/z4DPgSDOus67zrzOvc6+zr/PgA=='); 32$greek_upper = base64_decode('zprOm86czp3Ons6fzqDOoSDOms6bzpzOnc6ezp/OoA=='); 33$greek_mixed = base64_decode('zrrOu868zr3Ovs6fzqDOoSDOus67zpzOnc6+zr/OoA=='); 34$greek_haystacks = array($greek_lower, $greek_upper, $greek_mixed); 35 36$greek_nlower = base64_decode('zrzOvc6+zr8='); 37$greek_nupper = base64_decode('zpzOnc6ezp8='); 38$greek_nmixed1 = base64_decode('zpzOnc6+zr8='); 39$greek_nmixed2 = base64_decode('zrzOvc6+zp8='); 40 41$greek_needles = array( 42 // 4 good ones 43 $greek_nlower, $greek_nupper, $greek_nmixed1, $greek_nmixed2, 44); 45 46// try the basic options 47echo "\n -- ASCII Strings --\n"; 48foreach ($ascii_needles as $needle) { 49 foreach ($ascii_haystacks as $haystack) { 50 var_dump(mb_strripos($haystack, $needle)); 51 var_dump(mb_strripos($haystack, $needle, 14)); 52 } 53} 54 55echo "\n -- Greek Strings --\n"; 56foreach ($greek_needles as $needle) { 57 foreach ($greek_haystacks as $haystack) { 58 var_dump(mb_strripos($haystack, $needle)); 59 var_dump(mb_strripos($haystack, $needle, 12)); 60 } 61} 62 63echo "Done"; 64?> 65--EXPECT-- 66*** Testing mb_strripos() : basic functionality*** 67 68 -- ASCII Strings -- 69int(13) 70bool(false) 71int(13) 72bool(false) 73int(13) 74bool(false) 75int(13) 76bool(false) 77int(13) 78bool(false) 79int(13) 80bool(false) 81int(13) 82bool(false) 83int(13) 84bool(false) 85int(13) 86bool(false) 87int(13) 88bool(false) 89int(13) 90bool(false) 91int(13) 92bool(false) 93 94 -- Greek Strings -- 95int(11) 96bool(false) 97int(11) 98bool(false) 99int(11) 100bool(false) 101int(11) 102bool(false) 103int(11) 104bool(false) 105int(11) 106bool(false) 107int(11) 108bool(false) 109int(11) 110bool(false) 111int(11) 112bool(false) 113int(11) 114bool(false) 115int(11) 116bool(false) 117int(11) 118bool(false) 119Done 120