This code, which great God, help me to read. Thank you

Source: Internet
Author: User
$age = Empty ($_post[' age ') "1:trim ($_post[' age ']);

$taste = Empty ($_post[' taste '))? 1:trim ($_post[' taste ']), $drink = Empty ($_post[' drink '))? 0:trim ($_post[' drink ']); $ drink_quantity = Empty ($_post[' drink_quantity '))? 0:trim ($_post[' drink_quantity '); $potation = Empty ($_post[') Potation '])? 0:trim ($_post[' potation '); $coffee = empty ($_post[' coffee '])? 0:trim ($_post[' coffee ']); $smoke = Empty ($ _post[' smoke ')? 0:trim ($_post[' smoke ']), $medicine _type = Empty ($_post[' medicine_type '])? 0:trim ($_post[' Medicine_ Type ']); $movement = Empty ($_post[' movement ')? 0:trim ($_post[' movement ']); $movement _name = Empty ($_post[' Movement_ Name '])? ': Trim ($_post[' movement_name '); $work = Empty ($_post[' work ') "0:trim ($_post[' work ']); $pressure = Empty ($_ post[' pressure ')? 0:trim ($_post[' pressure ']), $tired = Empty ($_post[' tired '))? 0:trim ($_post[' tired ']); $cold = Empty ($_post[' cold ')? 0:trim ($_post[' cold '); $hands = Empty ($_post[' hands '])? 0:trim ($_post[' hands ']); $pregnant = Empty ( $_post[' pregnant ')? 0:trim ($_post[' pregnant ']), $lactation = Empty ($_post[' lactation '])? 0:trim ($_post[' lactation '); $edema = Empty ($_post[' edema ')? 0:trim ($_post[' edema ']); $edema _po = Empty ($_post[' Edema_po '])? 0:trim ($_post[' Edema_po '); $discomfort = empty ($_post[' discomfort '])? 0:trim ($_post[' discomfort '); $makeup _name = Empty ($_post[' makeup_name '])? ': Trim ($_post[' makeup_name '); $shaping _name = Empty ($_post[' shaping_name '])? 0:trim ($_post[' shaping_name '); $shaping = Empty ($_post[' shaping '])? 0:trim ($_post[' shaping '); $skin = empty ($_post[' skin ')? 0:trim ($_post[' skin '); $skin _pro = Empty ($_post[' Skin_pro '])? Array (): $_post[' Skin_pro '; $skin _pro = Implode (', ', $skin _pro); $body _pro = Empty ($_post[' Body_pro '])? Array (): $_post[' Body_pro '; $body _pro = Implode (', ', $body _pro); $course = Empty ($_post[' course '])? 0:trim ($_post[' course '); $nursing _period = Empty ($_post[' nursing_period '])? 0:trim ($_post[' nursing_period '); $nursing _inter = Empty ($_post[' nursing_inter '])? 0:trim ($_post[' nursing_inter '); $treatment _cost = Empty ($_post[' treatment_cost '])? 0:tRim ($_post[' treatment_cost '); $HOMEP _roducts = Empty ($_post[' homep_roducts '])? 0:trim ($_post[' homep_roducts ');

Reply content:

$age = Empty ($_post[' age ') "1:trim ($_post[' age ']);

$taste = Empty ($_post[' taste '))? 1:trim ($_post[' taste ']), $drink = Empty ($_post[' drink '))? 0:trim ($_post[' drink ']); $ drink_quantity = Empty ($_post[' drink_quantity '))? 0:trim ($_post[' drink_quantity '); $potation = Empty ($_post[') Potation '])? 0:trim ($_post[' potation '); $coffee = empty ($_post[' coffee '])? 0:trim ($_post[' coffee ']); $smoke = Empty ($ _post[' smoke ')? 0:trim ($_post[' smoke ']), $medicine _type = Empty ($_post[' medicine_type '])? 0:trim ($_post[' Medicine_ Type ']); $movement = Empty ($_post[' movement ')? 0:trim ($_post[' movement ']); $movement _name = Empty ($_post[' Movement_ Name '])? ': Trim ($_post[' movement_name '); $work = Empty ($_post[' work ') "0:trim ($_post[' work ']); $pressure = Empty ($_ post[' pressure ')? 0:trim ($_post[' pressure ']), $tired = Empty ($_post[' tired '))? 0:trim ($_post[' tired ']); $cold = Empty ($_post[' cold ')? 0:trim ($_post[' cold '); $hands = Empty ($_post[' hands '])? 0:trim ($_post[' hands ']); $pregnant = Empty ( $_post[' pregnant ')? 0:trim ($_post[' pregnant ']), $lactation = Empty ($_post[' lactation '])? 0:trim ($_post[' lactation '); $edema = Empty ($_post[' edema ')? 0:trim ($_post[' edema ']); $edema _po = Empty ($_post[' Edema_po '])? 0:trim ($_post[' Edema_po '); $discomfort = empty ($_post[' discomfort '])? 0:trim ($_post[' discomfort '); $makeup _name = Empty ($_post[' makeup_name '])? ': Trim ($_post[' makeup_name '); $shaping _name = Empty ($_post[' shaping_name '])? 0:trim ($_post[' shaping_name '); $shaping = Empty ($_post[' shaping '])? 0:trim ($_post[' shaping '); $skin = empty ($_post[' skin ')? 0:trim ($_post[' skin '); $skin _pro = Empty ($_post[' Skin_pro '])? Array (): $_post[' Skin_pro '; $skin _pro = Implode (', ', $skin _pro); $body _pro = Empty ($_post[' Body_pro '])? Array (): $_post[' Body_pro '; $body _pro = Implode (', ', $body _pro); $course = Empty ($_post[' course '])? 0:trim ($_post[' course '); $nursing _period = Empty ($_post[' nursing_period '])? 0:trim ($_post[' nursing_period '); $nursing _inter = Empty ($_post[' nursing_inter '])? 0:trim ($_post[' nursing_inter '); $treatment _cost = Empty ($_post[' treatment_cost '])? 0:tRim ($_post[' treatment_cost '); $HOMEP _roducts = Empty ($_post[' homep_roducts '])? 0:trim ($_post[' homep_roducts ');

This is a problematic code ...
Replace empty () with isset () ...
Otherwise there will be notice ...

Use the ternary operator, which is the statement ? : ; , to determine whether it is empty with empty

A bunch of variables are empty, not empty spaces

? : This operator you get to know

This is the code that gets the data from the Post's form data.
The main meaning of the first line of the null check is that if the taste in the _post array is empty $taste the variable is assigned 1 otherwise the form data
The other code is pretty much the same thing. Implode is to pass over the string, split the cut into groups

Like XX? The format of the A:B is called the three-mesh operator

$v =empty (xxxx)? A:b

$V is a variable
= number is an assignment character
Empty (xxxx)? Equivalent to a judgment. Empty is a function that determines whether it is null
If xxxx is empty the value of $v is assigned a
If XXXX is not empty then the value of $v is assigned to B

Objection to the high-ticket answer for the following reasons:

  • 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.