PHP - Function to replace nth occurence of a string without preg_match or preg_replace. In both 5.6 and 7.0

I need a PHP function that can to a str_replace on specified occurrence of the needle in the haystack.

So for example

function replace_nth(find, replace, haystack, position).

function replace_nth('the', 'a', 'the angry man jumped over the gate and ate the sandwich', 2) {


should return "the angry man jumped over a gate and ate the sandwich".

the function shouldn't use any preg_match or preg_replace functions.

I need a version that works in PHP 5.6 and a version that works in PHP7 (if there is a better one that is using PHP 7 functions.


Taidot: PHP

Näytä lisää: php function match data, developer in php function, freelance 5 6 7 8 mei 2016, joomla fatal error call to a member function get document on null in * plugins system sef sef php on line 36, pecl oci8 requires php version 7.0 0 installed version is 5.6 19 0 deb8u1, Write a public class method chopMiddle that accepts a String parameter with 5 integers in it separated by commas (e.g. “1,2,3,, calling a php function from an html form in the same file, php warning: module 'timezonedb' already loaded in unknown on line 0, magento supports php 5.6, 7.0.2, and 7.0.6 or later error, 1 2 3 4 5 6 7 8 9 10 what's the mistake, php function return string, 28 60 48 5 6 7 3 ? 4 72 114 128, 1/7, 3/4, 4/9, 5/6, 7/11, 7/8, ?, which number comes next in this series 1 2 3 5 6 7 9, 1 2 3 2 5 6 7 8 3 find the next term in the series, ungalugu february 14 enna nadagumnu papoma choose the number 1 2 3 4 5 6 7 8 9 10, string match in shell script, how to call php function in html, consider the following time series data: month 1 2 3 4 5 6 7 value 24 13 21 14 20 23 15, consider the following time series data: month 1 2 3 4 5 6 7 value 24 15 21 13 19 21 16

Tietoa työnantajasta:
( 21 arvostelua ) Yonkers, United States

Projektin tunnus: #23926573

Myönnetty käyttäjälle:


Hi greetings of the day I am a Experienced PHP Developer based out in Chennai,India. My experience revolves around development of web and mobile applications,Ecommerce websites. I believe that I am well qualified to un Lisää

$20 USD 1 päivässä
(68 Arvostelua)

15 freelanceria on tarjonnut keskimäärin 22$ tähän työhön


Hi there, I can code this function within minutes. It would work on both PHP 5.6 and 7.0 and wouldn't use preg_replace nor preg_match. Regards, Julijan

$25 USD 1 päivässä
(123 arvostelua)

Hello. I can create a replace_nth function that works in both PHP 5 and PHP 7 without using preg_match or preg_replace functions. We can discuss further details on chat.

$30 USD 1 päivässä
(210 arvostelua)

Hello, this is very simple to code, and yes it will work without preg_match. If you are interested in working with me, feel free to message me and i will code it in ~15-20 minutes. Thanks, Milan

$15 USD 1 päivässä
(247 arvostelua)

Hi, I can create a script to replace nth occurrence of a string with using regx. I'll start working on it from now and can create it today. Thanks!

$25 USD 1 päivässä
(45 arvostelua)

Hi my name is Muhammad Hassan. I have high level expertise in PHP. I can create a function for you so that i can replace the nth word on the sentence. I can start right now and can do the work on time. Please share the Lisää

$10 USD 1 päivässä
(19 arvostelua)

Senior Developer, based in Melbourne Australia with over 8 years+ industry experience. Over the years I've worked on the development of a wide variety of projects including many PHP scripting projects. This would be a Lisää

$20 USD 7 päivässä
(5 arvostelua)

HI I am experienced in PHP Report Project etc I can start right now but i have few doubts and questions lets have a quick chat and get it started waiting for your reply

$20 USD 7 päivässä
(2 arvostelua)

Hello I have read your project carefully and we have made multiple projects like that before in our agency I can you a sample of our work please chat with me to make sure we are very experts at our work hope to hear fr Lisää

$25 USD 7 päivässä
(3 arvostelua)

Dear client, how are you? I am Marko. I have deep experience in PHP. I can start your project now and will give perfect results. Please message me in order to discuss about more details, thanks!

$25 USD 1 päivässä
(3 arvostelua)

Hi, Nice to meet you! I am very interesting your project and I am confident of I can help your job. I am confident of this project as I'm a professional php expert with over 7 years of experience. Seems to be an intere Lisää

$30 USD 1 päivässä
(1 arvostelu)

Php is a simple project for me. Hello sir! Nice to meet you. I have experience in working with web-based applications and developing scripts using PHP language. I am a certified PHP developer with sound knowledge of Lisää

$25 USD 1 päivässä
(1 arvostelu)

Dear Hiring Team I have over 10 years of experience as an application developer and your job post requirements are precisely what I specialise in. In the current workplace where I am employed, I predominantly delive Lisää

$21 USD 1 päivässä
(0 arvostelua)

Hello, there. I have read your job description carefully. I am Php expert and have 5+ years of experience. I am sure that I can do your task within 1 hour. Thank you

$30 USD 1 päivässä
(0 arvostelua)

Hi there! I have a 12 years of experience in PHP algorithms. I think I have a solution for you. Please allow me to prove myself.

$15 USD 1 päivässä
(0 arvostelua)