How about using explode to split the string Into an array at | and then use index 1.
$arr = explode("|", $string); echo $arr(1);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a string like this...
"Export Result for DMGS | JSS 1A | English Studies | 2017/2018"
JSS 1A is dynamic, i.e, it changes depending on the data exported. I only want to remove other parts of the string leaving just JSS 1A or whatever it is that will be placed there...
Thanks alot!
How about using explode to split the string Into an array at | and then use index 1.
$arr = explode("|", $string); echo $arr(1);
Please or to participate in this conversation.