I'm looking for a way to remove a price from the end of a paragraph of text.
I've looked at rtrim but I can't work out how to get it to find the £ sign and remove it plus everything to the right of this in a string!
Can anyone please help with this?
Thanks in advance!
Can you provide examples of the paragraph you will receive and the output you expect?
Here's an example of the text I need to remove the price at the end from:
Tyre condition Good, Standard Features - Elektra cloth upholstery, Manual height adjustable front seats, Power assisted steering, Silver interior trim, Smokers pack, 16 double spoke alloy wheels style 222, BMW Business radio with single CD player, Solid paint, Reach + rake adjustable steering column, Body colour bumpers, Front head restraints, Dynamic brake control, Seat belt force limiter, Inflatable Tubular Structure head airbags for front/rear, 3 spoke sports leather steering wheel, 60/40 split rear seats, Driver/Passenger airbags (Impact dependent), Multifunction steering wheel with audio controls, Front isofix attachment + airbag deactivation, On board diagnostics, CBC - (Cornering brake control), Thatcham Category 1 alarm, Crash sensor, Front fog lights, Remote central locking, On board computer, Experian auto check clear. £10,250
Okay, so if you know it will always be at the end, I'd suggest using substr with strrpos
$textWithoutPrice = substr($text, 0, strrpos($text, '£'));
Works perfectly! thanks for the help with this.
This topic is now closed. New replies are no longer allowed.