Find Jobs
Hire Freelancers

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

$10-30 USD

Completed
Posted about 4 years ago

$10-30 USD

Paid on delivery
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. It should also not rely on any strlen() function. 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. Thanks
Project ID: 23942879

About the project

1 proposal
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello, ⭐⭐⭐⭐⭐ i am interested in this project , i can do this php function easily i can begin now waiting your answer on chat Regards ⭐⭐⭐⭐⭐
$29 USD in 1 day
4.9 (39 reviews)
4.7
4.7

About the client

Flag of UNITED STATES
Yonkers, United States
5.0
29
Payment method verified
Member since Sep 26, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.