Skip to content
Advertisement

Tag: substr

Remove characters from beginning and end string

I want to ouput only MYID from URL. What I did so far: output: https://whatever.expamle.com/display/MYID ouput: MYID?out=1234567890?Browser=0?OS=1 How can I combine this? Thanks. Answer When the string is always a Uniform Resource Locator (URL), like you present it in your question, given the following string: you can benefit from parsing it first: and then making use of the fact that

remove part of string after delimiter in php

I have seen other I have a string ” cccc cccc – fff” I need to return “cccc cccc” I don’t need to delimiter too I tried to echo the result of substr($mystring , 0, strpos($mystring , “-“)); but it return nothing I also tried resulted returned the main string and trash resulted nothing Update: i’m using wordpress and for

Advertisement