substr_replace.phpt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. --TEST--
  2. substr_replace() function
  3. --FILE--
  4. <?php
  5. $str = "try this";
  6. $repl = "bala ";
  7. $start = 2;
  8. echo "\n";
  9. echo "substr_replace('$str', '$repl', $start)\n";
  10. var_dump(substr_replace($str, $repl, $start));
  11. echo "\n";
  12. $len = 3;
  13. echo "substr_replace('$str', '$repl', $start, $len)\n";
  14. var_dump(substr_replace($str, $repl, $start, $len));
  15. echo "\n";
  16. $len = 0;
  17. echo "substr_replace('$str', '$repl', $start, $len)\n";
  18. var_dump(substr_replace($str, $repl, $start, $len));
  19. echo "\n";
  20. $len = -2;
  21. echo "substr_replace('$str', '$repl', $start, $len)\n";
  22. var_dump(substr_replace($str, $repl, $start, $len));
  23. echo "\n";
  24. echo "\n";
  25. echo "\n";
  26. $str = "try this";
  27. $repl = array("bala ");
  28. $start = 4;
  29. $len = 3;
  30. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
  31. var_dump(substr_replace($str, $repl, $start))."\n";
  32. echo "\n";
  33. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
  34. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  35. echo "\n";
  36. echo "\n";
  37. echo "\n";
  38. echo "\n";
  39. $str = array("ala portokala");
  40. $repl = array("bala ");
  41. $start = array(4);
  42. $len = array(3);
  43. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1)."")."\n";
  44. var_dump(substr_replace($str, $repl, $start))."\n";
  45. echo "\n";
  46. $len = array(3);
  47. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
  48. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  49. echo "\n";
  50. $len = array(0);
  51. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
  52. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  53. echo "\n";
  54. $len = array(-2);
  55. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).", ".var_export($start,1).", ".var_export($len,1).")")."\n";
  56. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  57. echo "\n";
  58. echo "\n";
  59. echo "\n";
  60. $str = array("ala portokala");
  61. $repl = "bala ";
  62. $start = 4;
  63. $len = 3;
  64. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
  65. var_dump(substr_replace($str, $repl, $start))."\n";
  66. echo "\n";
  67. echo "\n";
  68. $str = array("ala portokala", "try this");
  69. $repl = array("bala ");
  70. $start = 4;
  71. $len = 3;
  72. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  73. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  74. echo "\n";
  75. echo "\n";
  76. $str = array("ala portokala", "try this");
  77. $repl = "bala ";
  78. $start = 4;
  79. $len = 3;
  80. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  81. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  82. echo "\n";
  83. $str = array("ala portokala", "try this");
  84. $repl = array("bala ");
  85. $start = 4;
  86. $len = 0;
  87. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  88. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  89. echo "\n";
  90. echo "\n";
  91. $str = array("ala portokala", "try this");
  92. $repl = "bala ";
  93. $start = 4;
  94. $len = 0;
  95. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  96. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  97. echo "\n";
  98. $str = array("ala portokala", "try this");
  99. $repl = array("bala ");
  100. $start = 4;
  101. $len = -2;
  102. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  103. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  104. echo "\n";
  105. echo "\n";
  106. $str = array("ala portokala", "try this");
  107. $repl = "bala ";
  108. $start = 4;
  109. $len = -2;
  110. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  111. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  112. echo "\n";
  113. echo "\n";
  114. echo "\n";
  115. echo "\n";
  116. echo "\n";
  117. echo "\n";
  118. $str = array("ala portokala");
  119. $repl = "bala ";
  120. $start = array(4);
  121. $len = 3;
  122. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
  123. var_dump(substr_replace($str, $repl, $start))."\n";
  124. echo "\n";
  125. echo "\n";
  126. $str = array("ala portokala", "try this");
  127. $repl = array("bala ");
  128. $start = array(4);
  129. $len = 3;
  130. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  131. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  132. echo "\n";
  133. echo "\n";
  134. $str = array("ala portokala", "try this");
  135. $repl = "bala ";
  136. $start = array(4);
  137. $len = 3;
  138. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  139. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  140. echo "\n";
  141. $str = array("ala portokala", "try this");
  142. $repl = array("bala ");
  143. $start = array(4);
  144. $len = 0;
  145. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  146. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  147. echo "\n";
  148. echo "\n";
  149. $str = array("ala portokala", "try this");
  150. $repl = "bala ";
  151. $start = array(4);
  152. $len = 0;
  153. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  154. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  155. echo "\n";
  156. $str = array("ala portokala", "try this");
  157. $repl = array("bala ");
  158. $start = array(4);
  159. $len = -2;
  160. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  161. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  162. echo "\n";
  163. echo "\n";
  164. $str = array("ala portokala", "try this");
  165. $repl = "bala ";
  166. $start = array(4);
  167. $len = -2;
  168. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  169. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  170. echo "\n";
  171. echo "\n";
  172. echo "\n";
  173. echo "\n";
  174. echo "\n";
  175. echo "\n";
  176. echo "\n";
  177. $str = array("ala portokala");
  178. $repl = "bala ";
  179. $start = array(4,2);
  180. $len = 3;
  181. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
  182. var_dump(substr_replace($str, $repl, $start))."\n";
  183. echo "\n";
  184. echo "\n";
  185. $str = array("ala portokala", "try this");
  186. $repl = array("bala ");
  187. $start = array(4,2);
  188. $len = 3;
  189. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  190. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  191. echo "\n";
  192. echo "\n";
  193. $str = array("ala portokala", "try this");
  194. $repl = "bala ";
  195. $start = array(4,2);
  196. $len = 3;
  197. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  198. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  199. echo "\n";
  200. $str = array("ala portokala", "try this");
  201. $repl = array("bala ");
  202. $start = array(4,2);
  203. $len = 0;
  204. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  205. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  206. echo "\n";
  207. echo "\n";
  208. $str = array("ala portokala", "try this");
  209. $repl = "bala ";
  210. $start = array(4,2);
  211. $len = 0;
  212. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  213. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  214. echo "\n";
  215. $str = array("ala portokala", "try this");
  216. $repl = array("bala ");
  217. $start = array(4,2);
  218. $len = -2;
  219. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  220. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  221. echo "\n";
  222. echo "\n";
  223. $str = array("ala portokala", "try this");
  224. $repl = "bala ";
  225. $start = array(4,2);
  226. $len = -2;
  227. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  228. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  229. echo "\n";
  230. echo "\n";
  231. echo "\n";
  232. echo "\n";
  233. echo "\n";
  234. echo "\n";
  235. echo "\n";
  236. $str = array("ala portokala");
  237. $repl = "bala ";
  238. $start = array(4,2);
  239. $len = array(3);
  240. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
  241. var_dump(substr_replace($str, $repl, $start))."\n";
  242. echo "\n";
  243. echo "\n";
  244. $str = array("ala portokala", "try this");
  245. $repl = array("bala ");
  246. $start = array(4,2);
  247. $len = array(3);
  248. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  249. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  250. echo "\n";
  251. echo "\n";
  252. $str = array("ala portokala", "try this");
  253. $repl = "bala ";
  254. $start = array(4,2);
  255. $len = array(3);
  256. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  257. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  258. echo "\n";
  259. $str = array("ala portokala", "try this");
  260. $repl = array("bala ");
  261. $start = array(4,2);
  262. $len = array(0);
  263. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  264. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  265. echo "\n";
  266. echo "\n";
  267. $str = array("ala portokala", "try this");
  268. $repl = "bala ";
  269. $start = array(4,2);
  270. $len = array(0);
  271. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  272. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  273. echo "\n";
  274. $str = array("ala portokala", "try this");
  275. $repl = array("bala ");
  276. $start = array(4,2);
  277. $len = array(-2);
  278. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  279. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  280. echo "\n";
  281. echo "\n";
  282. $str = array("ala portokala", "try this");
  283. $repl = "bala ";
  284. $start = array(4,2);
  285. $len = array(-2);
  286. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  287. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  288. echo "\n";
  289. echo "\n";
  290. echo "\n";
  291. echo "\n";
  292. echo "\n";
  293. echo "\n";
  294. echo "\n";
  295. $str = array("ala portokala");
  296. $repl = "bala ";
  297. $start = array(4,2);
  298. $len = array(3,2);
  299. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).")")."\n";
  300. var_dump(substr_replace($str, $repl, $start))."\n";
  301. echo "\n";
  302. echo "\n";
  303. $str = array("ala portokala", "try this");
  304. $repl = array("bala ");
  305. $start = array(4,2);
  306. $len = array(3,2);
  307. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  308. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  309. echo "\n";
  310. echo "\n";
  311. $str = array("ala portokala", "try this");
  312. $repl = "bala ";
  313. $start = array(4,2);
  314. $len = array(3,2);
  315. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  316. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  317. echo "\n";
  318. $str = array("ala portokala", "try this");
  319. $repl = array("bala ");
  320. $start = array(4,2);
  321. $len = array(0,0);
  322. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  323. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  324. echo "\n";
  325. echo "\n";
  326. $str = array("ala portokala", "try this");
  327. $repl = "bala ";
  328. $start = array(4,2);
  329. $len = array(0,0);
  330. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  331. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  332. echo "\n";
  333. $str = array("ala portokala", "try this");
  334. $repl = array("bala ");
  335. $start = array(4,2);
  336. $len = array(-2,-3);
  337. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  338. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  339. echo "\n";
  340. echo "\n";
  341. $str = array("ala portokala", "try this");
  342. $repl = "bala ";
  343. $start = array(4,2);
  344. $len = array(-2,-3);
  345. echo str_replace("\n","","substr_replace(".var_export($str,1).", ".var_export($repl,1).",".var_export($start,1).", ".var_export($len,1).")")."\n";
  346. var_dump(substr_replace($str, $repl, $start, $len))."\n";
  347. echo "\n";
  348. ?>
  349. --EXPECT--
  350. substr_replace('try this', 'bala ', 2)
  351. string(7) "trbala "
  352. substr_replace('try this', 'bala ', 2, 3)
  353. string(10) "trbala his"
  354. substr_replace('try this', 'bala ', 2, 0)
  355. string(13) "trbala y this"
  356. substr_replace('try this', 'bala ', 2, -2)
  357. string(9) "trbala is"
  358. substr_replace('try this', array ( 0 => 'bala ',), 4
  359. string(9) "try bala "
  360. substr_replace('try this', array ( 0 => 'bala ',), 4
  361. string(10) "try bala s"
  362. substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,)
  363. array(1) {
  364. [0]=>
  365. string(9) "ala bala "
  366. }
  367. substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 3,))
  368. array(1) {
  369. [0]=>
  370. string(15) "ala bala tokala"
  371. }
  372. substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 0,))
  373. array(1) {
  374. [0]=>
  375. string(18) "ala bala portokala"
  376. }
  377. substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => -2,))
  378. array(1) {
  379. [0]=>
  380. string(11) "ala bala la"
  381. }
  382. substr_replace(array ( 0 => 'ala portokala',), 'bala ',4)
  383. array(1) {
  384. [0]=>
  385. string(9) "ala bala "
  386. }
  387. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 3)
  388. array(2) {
  389. [0]=>
  390. string(15) "ala bala tokala"
  391. [1]=>
  392. string(5) "try s"
  393. }
  394. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 3)
  395. array(2) {
  396. [0]=>
  397. string(15) "ala bala tokala"
  398. [1]=>
  399. string(10) "try bala s"
  400. }
  401. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 0)
  402. array(2) {
  403. [0]=>
  404. string(18) "ala bala portokala"
  405. [1]=>
  406. string(8) "try this"
  407. }
  408. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 0)
  409. array(2) {
  410. [0]=>
  411. string(18) "ala bala portokala"
  412. [1]=>
  413. string(13) "try bala this"
  414. }
  415. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, -2)
  416. array(2) {
  417. [0]=>
  418. string(11) "ala bala la"
  419. [1]=>
  420. string(6) "try is"
  421. }
  422. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, -2)
  423. array(2) {
  424. [0]=>
  425. string(11) "ala bala la"
  426. [1]=>
  427. string(11) "try bala is"
  428. }
  429. substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4,))
  430. array(1) {
  431. [0]=>
  432. string(9) "ala bala "
  433. }
  434. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 3)
  435. array(2) {
  436. [0]=>
  437. string(15) "ala bala tokala"
  438. [1]=>
  439. string(5) " this"
  440. }
  441. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 3)
  442. array(2) {
  443. [0]=>
  444. string(15) "ala bala tokala"
  445. [1]=>
  446. string(10) "bala this"
  447. }
  448. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 0)
  449. array(2) {
  450. [0]=>
  451. string(18) "ala bala portokala"
  452. [1]=>
  453. string(8) "try this"
  454. }
  455. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 0)
  456. array(2) {
  457. [0]=>
  458. string(18) "ala bala portokala"
  459. [1]=>
  460. string(13) "bala try this"
  461. }
  462. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), -2)
  463. array(2) {
  464. [0]=>
  465. string(11) "ala bala la"
  466. [1]=>
  467. string(2) "is"
  468. }
  469. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), -2)
  470. array(2) {
  471. [0]=>
  472. string(11) "ala bala la"
  473. [1]=>
  474. string(7) "bala is"
  475. }
  476. substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
  477. array(1) {
  478. [0]=>
  479. string(9) "ala bala "
  480. }
  481. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 3)
  482. array(2) {
  483. [0]=>
  484. string(15) "ala bala tokala"
  485. [1]=>
  486. string(5) "trhis"
  487. }
  488. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 3)
  489. array(2) {
  490. [0]=>
  491. string(15) "ala bala tokala"
  492. [1]=>
  493. string(10) "trbala his"
  494. }
  495. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 0)
  496. array(2) {
  497. [0]=>
  498. string(18) "ala bala portokala"
  499. [1]=>
  500. string(8) "try this"
  501. }
  502. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 0)
  503. array(2) {
  504. [0]=>
  505. string(18) "ala bala portokala"
  506. [1]=>
  507. string(13) "trbala y this"
  508. }
  509. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), -2)
  510. array(2) {
  511. [0]=>
  512. string(11) "ala bala la"
  513. [1]=>
  514. string(4) "tris"
  515. }
  516. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), -2)
  517. array(2) {
  518. [0]=>
  519. string(11) "ala bala la"
  520. [1]=>
  521. string(9) "trbala is"
  522. }
  523. substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
  524. array(1) {
  525. [0]=>
  526. string(9) "ala bala "
  527. }
  528. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3,))
  529. array(2) {
  530. [0]=>
  531. string(15) "ala bala tokala"
  532. [1]=>
  533. string(2) "tr"
  534. }
  535. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3,))
  536. array(2) {
  537. [0]=>
  538. string(15) "ala bala tokala"
  539. [1]=>
  540. string(7) "trbala "
  541. }
  542. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0,))
  543. array(2) {
  544. [0]=>
  545. string(18) "ala bala portokala"
  546. [1]=>
  547. string(2) "tr"
  548. }
  549. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0,))
  550. array(2) {
  551. [0]=>
  552. string(18) "ala bala portokala"
  553. [1]=>
  554. string(7) "trbala "
  555. }
  556. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2,))
  557. array(2) {
  558. [0]=>
  559. string(11) "ala bala la"
  560. [1]=>
  561. string(2) "tr"
  562. }
  563. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2,))
  564. array(2) {
  565. [0]=>
  566. string(11) "ala bala la"
  567. [1]=>
  568. string(7) "trbala "
  569. }
  570. substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,))
  571. array(1) {
  572. [0]=>
  573. string(9) "ala bala "
  574. }
  575. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,))
  576. array(2) {
  577. [0]=>
  578. string(15) "ala bala tokala"
  579. [1]=>
  580. string(6) "trthis"
  581. }
  582. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,))
  583. array(2) {
  584. [0]=>
  585. string(15) "ala bala tokala"
  586. [1]=>
  587. string(11) "trbala this"
  588. }
  589. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,))
  590. array(2) {
  591. [0]=>
  592. string(18) "ala bala portokala"
  593. [1]=>
  594. string(8) "try this"
  595. }
  596. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,))
  597. array(2) {
  598. [0]=>
  599. string(18) "ala bala portokala"
  600. [1]=>
  601. string(13) "trbala y this"
  602. }
  603. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,))
  604. array(2) {
  605. [0]=>
  606. string(11) "ala bala la"
  607. [1]=>
  608. string(5) "trhis"
  609. }
  610. substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,))
  611. array(2) {
  612. [0]=>
  613. string(11) "ala bala la"
  614. [1]=>
  615. string(10) "trbala his"
  616. }