三目运算求编译成if语句。该如何处理

WBOY
Release: 2016-06-13 13:31:24
Original
699 people have browsed it

三目运算求编译成if语句。。。
还有红色的-号那是个什么概念?

$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';



------解决方案--------------------
substr 函数的第2个参数 翻翻手册吧. 从哪里开始截取
------解决方案--------------------

探讨
还有红色的-号那是个什么概念?

$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

------解决方案--------------------
PHP code
if($ckey_length ){
    if ($operation == 'DECODE') {
        $keyc=substr($string, 0, $ckey_length);
    }else{
        $keyc=substr(md5(microtime()), -$ckey_length);
    }
}else{
    $keyc='';
} 
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!