Ask a function in the IF statement about the problem, I am a beginner

Source: Internet
Author: User
Ask a function in the IF statement problem, I rookie a
If there is a similar function, incomplete, just an example.

function p_abc ($a = ', $b = ', $c = ') {
$a = xxx
if ($b = ' 255 ') {
$a =xxx+1
}
$c =yyy

}


When $b = ' 255 ', the function works properly, and when $b is not equal to 255, it seems $c =yyy cannot execute (I'm not sure). Causes an error in the program.

Why is it? I rookie one, good-hearted people tell.



share to: more


------Solution--------------------
A = is an assignment
Two = is a comparison

you if ($b = ' 255 ') {is to make $b 255, the expression is always set
should be written if ($b = =' 255 ') {

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.