Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

getting data after | mark

i have a drop down menu which holds 3 different values

withoutMinutes|400m                  
withoutHours|10k Road
withHours|Marathon

how could  strip it so i can just add anything after | into my db?

so into my db would be

400m                  
10k Road
Marathon
0
runnerjp
Asked:
runnerjp
1 Solution
 
phpmonkeyCommented:
in this case where there is only 1 pipe symbol in it i would explode it.
list($part1,$part2) = explode("|",'withoutMinutes|400m');
echo $part1;//withoutMinutes
echo $part2;//400m

Open in new window

0
 
marchentCommented:
using preg_repalce() remove anything before | with empty
$str = 'withoutMinutes|400m';
$str = preg_replace('/.*\|/', '', $str);
print "$str\n";

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now