Mark Kennedy Mark Kennedy - 6 months ago 69
PHP Question

PHP equivalent of JavaScript getTime()

Suppose I'm running the following JavaScript getTime() function

<script language="JavaScript">
var $x = Math.round((new Date()).getTime()/1000);
</script>


What would the equivalent code in PHP look like?

Answer

Unix time in php

$time_stamp = time();
echo $time_stamp;