Tag: Reference – What does this symbol mean in PHP?


[Solved -7 Answers] PHP – show a number to 2 decimal places

PROBLEM: What’s the correct way to round a PHP string to 2 decimal places? Output  “520.00”; How function round_to_ 2dp() definition should be? SOLUTION 1: You can use number_format(): Example: This function returns a string. SOLUTION 2: Alternatively, SOLUTION 3: Try: SOLUTION 4: SOLUTION 5: It will return 5.98 without rounding the number SOLUTION 6: […]


[ Solved -8 Answers ] PHP – NOW() function in PHP

PROBLEM : Is there a PHP function that returns the date & time in the same format as the MySQL function NOW()? We know how to do it using date(), but we asking if there is a function only for this. For example to return: 2009-12-01 00:00:00 php datetime time timestamp SOLUTION 1: Try this […]


PHP – Difference between array_map, array_walk and array_filter

array_map: (PHP 4 >= 4.0.6, PHP 5, PHP 7) array_map — Applies the callback to the elements of the given arrays Description: array_map() returns an array containing all the elements of array1 after applying the callback function to each one. The number of parameters that the callback function accepts should match the number of arrays […]