Forum Moderators: coopster

Message Too Old, No Replies

query filtering

         

joshm

2:30 am on May 29, 2007 (gmt 0)

10+ Year Member



Some of my queries are set up to be links:

example: /this-query-7.1.5.9-here.htm

I want to eliminate 7.1.5.9 from the link.

so it becomes: /this-query-here.htm

How can I do this in php?

eelixduppy

2:32 am on May 29, 2007 (gmt 0)



Are you saying that you want to replace the url format for each link on a page before it is echoed to the browser?

joshm

2:49 am on May 29, 2007 (gmt 0)

10+ Year Member



The links are statically posted to a page. I just need to know the php code to filter out version numbers like 4.2.34 or whatever it may be.

linuxswan

6:25 am on May 29, 2007 (gmt 0)

10+ Year Member



I think you can use the string functions and remove the Numerical values and special characters.

Habtom

12:20 pm on May 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or may be explode it:
this-query-7.1.5.9-here.htm

$exploded[0].$exploded[1].$exploded[3]."htm"

Hab

joshm

2:19 pm on Jun 9, 2007 (gmt 0)

10+ Year Member



If I have for example:

$string = 'hello. hello';

How can I exclude all characters starting from .?

So I exclude '. hello' and it becomes:

'hello'

barns101

2:27 pm on Jun 9, 2007 (gmt 0)

10+ Year Member



$exploded_string = [url=http://www.php.net/explode]explode[/url]('.', $string);
$new_string = $exploded_string[0];