Why am i getting this output?
Posted: Thu Sep 11, 2008 1:23 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
ive tried running the above code which was taken from another site.
the output of the site should have been 081225,but the output that i get is 12/25/08.
Why am i not getting the desired output?
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Code: Select all
<?php
$string = '12/25/08';
$pattern = '|(d{2})/(d{2})/(d{2})|';
$replacement = '$3$1$2';
echo preg_replace($pattern, $replacement, $string);
?>the output of the site should have been 081225,but the output that i get is 12/25/08.
Why am i not getting the desired output?
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: