Hello Bob,

Nope, didn't work, it gave me this error:

*************************************
Fatal error: Cannot redeclare smallwords() (previously declared 
in /home/treasure/public_html/asb/start_search.php:250) 
in /home/treasure/public_html/asb/start_search.php on line 250
*************************************

Line 250 says:

function smallWords($value) {

This is what I am using now and it works great:

************************************
$filename=strtolower($title);
$filename = preg_replace("/[^a-z,^0-9 ]/", "", $filename);
$filename=substr(str_replace(" ","_",$filename),0,100).".html";
$remove = array
('_to_','_the_','_it_','_and_','_or_','_with_','_too_','_also_','_an_
','_if_','_at_','_a_','_i_','_in_','_for_','_of_','_on_','_it_','`','
!','@','#','$','%','^','&','*','(',')','[',']','{','}',':',';',',','?
','=','+','-','__','___','____');
$filename=str_replace($remove,"_",$filename);
$filename=str_replace($remove,"",$filename);
*************************************

I know it still has some symbols listed, I tried to use it without 
the symbols listed to be removed and for some reason, on one 
filename it had a "," in it, so I went back in and added a few 
symbols just to make sure it got all of them. I also added 
underscores before and after each word to be removed so that it 
would remove that word only and not remove those letters from other 
words ("toward" became "ward"). It doesn't matter if it's pretty or 
elegant, I just need it to work, and this works.


Thanks!

Wretha



--- In [email protected], "Bob" <[EMAIL PROTECTED]> wrote:
>
> Hi Wretha,
> No, it's just a hobby as I'm still learning (I'm retired - who 
said retarded?). I only *try* and answer the simpler questions as I 
remember when I first started :-)
> 
> Just come up with an even more elegant way, as I've just found 
arrayfilter();
> Saves having that awful array.
> 
> <?php
> $title = "Robert <123> #*&%$£! to the Say's it and or Hello too a 
if to";
> echo $title."<br /><br />";
> 
> $filename = strtolower($title);
> $filename = preg_replace("/[^a-z ]/", "", $filename);
> 
> function smallWords($value) {
>   return (strlen($value) >=4);
> }
> $filename = explode(" ", $filename);
> $filename = array_filter($filename, "smallWords");
> $filename = implode("_", $filename);
> 
> $filename = trim($filename).".html";
> echo $filename;
> ?>
> 
> The downloadable php manual is great, but it takes a lot of 
wadding through.
> Bob E.







Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to