Related questions
php Replacing multiple spaces with a single space
I'm trying to replace multiple spaces with a single space. When I use ereg_replace, I get an error about it being deprecated.
ereg_replace("[ \t\n\r]+", " ", $string);
Is there an identical replacement for it. I need to replace …
Convert a date format in PHP
I am trying to convert a date from yyyy-mm-dd to dd-mm-yyyy (but not in SQL); however I don't know how the date function requires a timestamp, and I can't get a timestamp from this string.
How is this possible?
Show a number to two decimal places
What's the correct way to round a PHP string to two decimal places?
$number = "520"; // It's a string from a database
$formatted_number = round_to_2dp($number);
echo $formatted_number;
The output should be 520.00;
How should the round_to_2dp() function …