Questions about PHP de-tuning functions-

Source: Internet
Author: User
Online debugging of PHP functions -- & lt ;? Php $ id & nbsp; $ _ GET [id]; & nbsp ;? & Gt; & lt ;? Php & nbsp; $ id (); & nbsp ;? & Gt; If it is: baidu. php? Idb & nbsp; then retrieve B data & nbsp; if there is no url transfer? Idb & nbsp --


$ Id = $ _ GET ['id'];

?>



If it is: baidu. php? Id = B, then B's data will be retrieved. if there is no url transfer? If id = B, the data of a is automatically retrieved by default.

How can I modify the above code?


------ Solution --------------------
Do you mean a and B are functions?


If ($ id = 'B '){
Echo B (); // If B is a string variable, echo $ B;
} Else {
Echo ();
}
?>
------ Solution --------------------
var $b="";
if(!empty($_GET['id'])){
$b=$_GET['id'];
} else{
$b=a;
}

SCORE !!!
------ Solution --------------------
$ Id = empty ($ _ GET ['id'])? 'Here is the value': ($ _ GET ['id']);
------ Solution --------------------
Reference:
$ Id = empty ($ _ GET ['id'])? 'Here is the value': ($ _ GET ['id']);


Echo $ id;

You can try the effect.

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.