preg_replace



Why does the following return an empty value for $string? Shouldn't
it replace the GIF at the end of the string with "gif" and return a
value of "hello.gif"?

<?php

$string = 'hello.GIF';

echo "<br/><br/>Before replacement, \$string = $string";

$old = '*GIF$';
$new = '*gif$';

$string = preg_replace($old, $new, $string);

echo "<br/><br/>After replacement, \$string = $string";

?>

At a minimum, the manual says that it should return the same string if
no match is made.

Thanks,

--Kenoli
.



Relevant Pages

  • Reading all frames and information of GIF [solution]
    ... Well, I've been bussy with a gif loader, because I needed all the frames. ... For each frame, the function addFrame(Image image, ... private static final String NODEPATH_HEIGHT = ... int imageHeight = Integer.parseInt(findValueWithPath(streamRoot, ...
    (comp.lang.java.programmer)
  • Re: php lost variable 0 from the form when i try to save it into mysql database - please help
    ... PHP is losting this value when it try to write it to mySQL. ... empty() doesn't behave exactly as you'd expect. ... (including the empty string). ...
    (comp.lang.php)
  • Re: Is there a free .GIF software?
    ... Is there a free software to generate .GIF files? ... Graphics canvas; ... // Create the bitmap and measure the size of the string. ... int width =; ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: preg_replace
    ... it replace the GIF at the end of the string with "gif" and return a ... the manual says that it should return the same string if ... If you want to make the entire filename lower-case, ...
    (alt.php)
  • Re: Nominating a web page to display GIFs
    ... specific gif to be displayed on it- in which case you could use a query ... string and scripting to use the correct image ... hyperlinked to each GIF and when I click on the icon each GIF displays ... can somehow ceate a hyperlink string for each icon that marries the ...
    (microsoft.public.frontpage.programming)