how to remove numbers from a string php

Mobile
feeds
Welcome Login | Register

how to remove numbers from a string php
Reply Your Comments:
Click this button if you are interested in replying to this topic and leave your comments
Sent To Friend
CLick this button if you want to send this page to a friend.
Subsribe To Rss Feeds
Subscribe to RSS
CLick this button if you want to subscribe to this RSS Feed. You can use your browsers feeds burners if you have mozilla or internet explorer 7 or higher and keep up with updates.
  Forums Index
      » Scripts Forums
        » » how to remove numbers from a string php
how to remove numbers from a string php
Post Description: how to remove numbers from a string php Scripts
Post Tags:
This Post Has Been Viewed 1794 Times Since Thu Feb 14, 2008 11:56 am Author hostman with 2 replies
how to remove numbers from a string php
Advertise On This Page




lets say you have a string in a form and you want to delete all the numbers from the value of that string. well, today, i will show you..

you can use this function

CODE:
<?php
	# FUNCTION BY WWW.WEBUNE.COM
	function remove_numbers($string) {
  		$vowels = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ");
  		$string = str_replace($vowels, '', $string);
  		return $string;
  	}
	$string='This string will have all numbers removed - 213 555 3930';
	echo remove_numbers($string);
?>


this will remove all the numbers from the variable string

OUTPUT:
This string will have all numbers removed -



Leave Your Comments

Share:   Subscribe - Keep Up With This Topic
You can use this HTML code to put it on your website to show your friends this wallpaper. Use this code on your profile like myspace, friendster, Facebook or others. Just Copy and Paste it in your HTML on your websites
URL:
To embed this topic, just copy the code from the "Embed" box. Once you've copied the code, just paste it into your website or blog to embed it.
Embed:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums
Fourms BBCODE:
Links Related to : how to remove numbers from a string php
Add Link:

Comments and replies About how to remove numbers from a string php
:: 1 :: Reply #83360 Reply By elpedro On Thu Nov 27, 2008 12:56 am
elpedro:
you can also remove text instead of numbers, just switch the numbers in
$vowels = array("y", "z", "3", "4", "4", "3", "z", "y", "x", "x", " "); to
$vowels = array("a", "b", "c", "d", "e", f", "g"," "); etc.

note:
if you wan't big letters for this function don't forget that you will need to verify this to the function like this:
$vowels = array("a", "b", "c", "d", "e", f", "g","a","b","c", "d" " "); etc.

great function!

:: 2 :: Reply #102959 Reply By Pradeep On Mon May 11, 2009 3:43 am
Pradeep:
it's really very good post. very helpful function. please keep it up.
downloadfreephpscripts

download free php scripts team