erme Posted February 15, 2013 Share Posted February 15, 2013 (edited) Looking to remove text* where * will be a number. The below doesn't work. Can anyone shed some light? str_replace(array('text[0-9]'), Array('')) Edited February 15, 2013 by erme Quote Link to comment Share on other sites More sharing options...
trq Posted February 15, 2013 Share Posted February 15, 2013 preg_replace. The manual is a programmers best friend. Quote Link to comment Share on other sites More sharing options...
erme Posted February 15, 2013 Author Share Posted February 15, 2013 So something along these lines? $title = preg_replace( array('text', '%\0-9/%'), array('', ''), $crumb); Quote Link to comment Share on other sites More sharing options...
erme Posted February 15, 2013 Author Share Posted February 15, 2013 Got it working myself preg_replace(array('/[0-9]/'),array(''), $title); Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted February 15, 2013 Share Posted February 15, 2013 You don't need array() in the function arguements, this will suffice: preg_replace('/[0-9]/', '', $title); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.