lor*_*lad 5 javascript php variables
有什么方法可以模仿javascripts在PHP中的松散变量处理?例如,在PHP我必须写
$instituteID = ( isset( $p['regInstituteName'] ) && isset( $p['regInstituteName']['ID'] ) ) ? $p['regInstituteName']['ID'] : null;
Run Code Online (Sandbox Code Playgroud)
而在javascript中,这将浓缩为
instituteID = p.regInstituteName && p.regInstituteName.id || null;
Run Code Online (Sandbox Code Playgroud)
看起来并没有多大区别,但它加起来