<?php
$x="101.5degrees";
(double)$x;
print_r($x . '\n');
(int)$x;
echo (string)$x;
?>
I expect to print the value of x on a new line.
<?php
$x="101.5degrees";
(double)$x;
print_r($x . '\n');
(int)$x;
echo (string)$x;
?>
I expect to print the value of x on a new line.
$x="101.5degrees";
(double)$x;
print_r($x);
(int)$x;
echo PHP_EOL.(string)$x;
try this out reference
While the other answers didn't really solve OP's problem, here is the correct way of using line breaks in PHP:
<?php
header('Content-Type: text/plain');
$x = "101.5degrees";
echo (double)$x . PHP_EOL;
echo (int)$x . PHP_EOL;
echo (string)$x . PHP_EOL;
?>
The output of the above code will be:
101.5
101
101.5degrees