0

I'm trying to echo only the integer from this script.

<?php
$hour = '<script type="text/javascript">
var x = new Date().getHours();
document.write(x)
</script>';

var_dump($hour);

my output from this is

string(93) "17"

but I just want to get my output as 17 as an integer.

When I try using parseInt it outputs 0.

How can I get it to output 17 instead of 0?

0 Answers0