Jump to content

Removing Alphabetical characters from string


Silverado_NL

Recommended Posts

hi everybody, im currently trying to automate the process of cleaning up Telephone Fields.

currently there are loads of fields in the database that contain both alphabetical characters and integer characters.

is there a command to remove these alphabetical characters in the string????

my goal is to end up with only number and no other characters.

if anybody has a clue, i'd sure like to know:)

 

Thanks you in advance.

 

 

 

Silverado

my goal is to end up with only number and no other characters.

 

In that case you need to make a little change with Iceman's script:

<?php

$string = "123This is the string that needs to have letters stripped from it, leaving: 1, 2, 3, 4, 5, ...";
$new_string = ereg_replace("[^0-9]", "", $string );
//$new_string now holds 12312345

?>

 

 

Orio.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.