Php Language-basics Examples Assertion Options Using the assert() Function shell style comments PHP comments are usually preceded by double slashes Php single line commentPhp more than single line comment Combine three types of comment signs A comment is text in a script that is ignored by the PHP engine. In PHP, everything between /* and */ is considered a comment Multiline comments Multiline comments begin with a forward slash followed by an asterisk (/*) and end with an asterisk followed by a forward slash (*/) PHP supports C, C++ and Unix shell-style comments Defining a Constant Define statement Stopping Page Execution the global statement is used Accessing Global Variables with the global Statement Using the global Statement to Remember the Value of a Variable Between Function Calls Set new value into GLOBALS values Looping Through the $GLOBALS Array $GLOBALS with property Create global variables Modifying a Variable with $GLOBALS Global vs function level Overriding Scope with the GLOBALS Array Test of PHP Includes Using include() Within a Loop Using include() to Execute PHP and Assign the Return Value Using include() Difference between instanceof and is_subclass_of( ) Using the instanceof Operator Check the modulus of the two values and print the result Functions to Check Data Type Functions to Convert Data Types Functions to Test Data Types GMP Functions Using the @ operator to suppress a warning about the undefined variables A First PHP Script A PHP Script Including HTML Spaces, tabs, and blank lines in between statements have no effect Spacing Opening and Closing Code Islands Instruction separation Keywords and function names are case insensitive Magic Constants Embedding multiple PHP scripts in a single document HTML and PHP together Hello, World! Mixed-Mode Processing Multiple start and end tags PHP 5 Data Types PHP supports trigonometric and logarithmic operations Basic PHP Start and End Tags Short circuit syntax Php tagPhp tagPhp tagTo output all information Create PNG file Add an PNG image to the image you generated Drawing a Polygon with imagefilledpolygon() __FILE____LINE__Assign reference to a variable unset reference variables Variable References Demo Assigning a Variable by Reference A static variable remembering its last value Using the static Statement to Remember the Value of a Variable Between Function Calls Using the static modifier to change a member or method so it is accessible without instantiating the class static variables Working with Static Variables in Functions Use static variable defined in function $b is assigned a copy of $a, and in the second part, $b is assigned a reference to $a. & operator creates a reference Create a reference to a variable with the name of the constant's value. Passing by Reference in PHP Only named variables may be assigned by reference. Passing arrays by reference Variable scopeUse variable defined outside function Scope of a Variable Variable ScopeVariables Defined Outside Functions Are Inaccessible from Within a Function by Default Defining Variable Scope More Working with Variable Scope local variables Variable Scope Variable Scope in Functions The isset() Function IsSet variable Unset variable unset() Function UnSet array element gettype() and settype() Testing the Type of a Variable Changing the Type of a Variable with settype() PHP Variable Examples PHP Superglobal Arrays PHP 5 variable functionality. A properly set-up PHP variable Automatic Type Conversion Calculate the variable name for simpler variables and use that name to access the value of that variable. Operating on variables valid statements Numbers Numeric Data Types Valid and invalid variable names Accessing Array Elements

Php Code : Stopping Page Execution

Stopping Page Execution in php


<?php
     $db_conn = mysql_connect ("imaginaryhost", "java2s", "password");
   
     // If no db connection, exit script
     if(!$db_conn)
     {
          print("<b>I could not connect to the database! :(</b><br />");
          print("This script will now exit<br />");
          exit;
     }
   
     mysql_close($db_conn);
?>