-1

I want to replace '/50' with URL.my URL is

http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=

I want url as

http://localhost/CI/admin/pcustomer/cprofile?customer=18267&mobile=&nearby=
Ram
  • 115
  • 8
  • Stack Overflow is *not* a code writing service. We are always glad to help and support new coders but you need to help yourself first. You are expected to try to write the code yourself. Please read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – brombeer Sep 14 '18 at 09:35
  • Are you storing your url as a `string` ? – Shreyas Achar Sep 14 '18 at 09:35
  • I didnt got what exactly your question is meant for, as i understood i will replace the string using the following code. `$string = 'http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby='; $expectedString = str_replace("/50",'',$string);` – Shreyas Achar Sep 14 '18 at 09:40

1 Answers1

0

From that little info in your question, this seems to be the simplest way to achieve "I want to replace '/50' with URL"

$url = str_replace('/50', '', 'http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=');
brombeer
  • 8,716
  • 5
  • 21
  • 27
  • not only /50 it was dynamically vary it goes /100 based on pagination @kerbholz – Ram Sep 14 '18 at 09:41
  • Learn how to ask a good question then, please, you didn't mention this anywhere in your question. As of now, all we can see is "_I want to replace '/50' with URL_". – brombeer Sep 14 '18 at 09:43