const a = parseInt('1.2');
$a = intval("1.2");
const b = parseFloat('1.2');
$b = floatval("1.2");
由于 php 中没有
undefined
关键字,故不支持返回undefined
,如果你写了,会被转成null
There is no
undefined
in PHP. It will be transformed tonull
if you use it.
const a = parseInt('1.2');
const c = typeof a;
const d = typeof c === 'string';
$a = intval("1.2");
$c = \Ts2Php_Helper::typeof($a);
$d = \Ts2Php_Helper::typeof($c) === "string";
const e = {a: 1, b: 2};
delete e.a;
$e = array( "a" => 1, "b" => 2 );
unset($e["a"]);
const f = navigator.userAgent;
$f = $_SERVER["HTTP_USER_AGENT"];
const g = __dirname;
const h = __filename;
$g = dirname(__FILE__);
$h = __FILE__;
import {escape} from './helper/export';
escape();
require_once(dirname(__FILE__) . '/' . "./helper/export.php");
\someModule\escape();