编程语言
首页 > 编程语言> > php开发笔记

php开发笔记

作者:互联网

http://127.0.0.1/test1.php

D:\ivanhan2019.hanasp\branches\php>php test1.php
3
-2

<?php

function Linefeed(){
$sapi_type = php_sapi_name();
if (isset($sapi_type) && substr($sapi_type, 0, 3) == 'cli') {
return "\n";
} else {
return "<br>";
}
}
$LF=Linefeed();

function fun($x){
if($x>0)return exp(log($x)/3);
if($x<0)return -exp(log(-$x)/3);
if($x==0)return 0;
}

echo(fun(27) . $LF);
echo(fun(-8) . $LF);
?>

标签:LF,return,sapi,笔记,开发,fun,php,type
来源: https://www.cnblogs.com/Ivanhan2019/p/14254506.html