strtotime,Floor, Abs, Ceil Functions In PHP

Bipsmedium
1 min readAug 25, 2020

strtotime():- This function converts and English text DateTime into a unique timestamp but we have to wrap the result using this date format date(‘Y-m-d’) to avoid the errors. For example

<?php

$date = '1 January 2020';

echo date('Y-m-d',strtotime($date));

?>

The output is 2020-01-01

floor():- This function returns a number down to its nearest integer. For example

<?php

echo floor(0.30).'<br>';

echo floor(3).'<br>';

echo floor(3.3).'<br>';

echo floor(-3.3).'<br>';

?>

The output will be like this----

0

3

3

-4

Ceil():- This function returns a number up to its nearest integer. For example:-

<?php

echo ceil(0.30).'<br>';

echo ceil(3).'<br>';

echo ceil(3.3).'<br>';

echo ceil(-3.3).'<br>';

?>

The output will be like this----

1

3

4

-3

--

--

Bipsmedium
Bipsmedium

Written by Bipsmedium

Hi, This is Biplab and I am a PHP laravel developer and other open source technologies. I am here to share my experience with the community.

No responses yet