[ Pobierz całość w formacie PDF ]
.See the Connection Handlingdescription in the Featureschapter for a complete explanation.connection_status (PHP3 >= 3.7, PHP4 >= 4.0b4)connection_status -- Returns connection status bitfieldDescriptionint connection_status (void )
Returns the connection status bitfield.See the Connection Handlingdescription in the Featureschapter for a complete explanation.connection_timeout (PHP3 >= 3.7, PHP4 >= 4.0b4)connection_timeout -- Return true if script timed outDescriptionint connection_timeout (void )
Returns true if script timed out.See the Connection Handlingdescription in the Featureschapter for a complete explanation.define (PHP3 , PHP4 )define -- Defines a named constant.Descriptionint define (string name, mixed value [, intcase_insensitive])
Defines a named constant, which is similar to a variable except:
Constants do not have a dollar sign '$' before them;
Constants may be accessed anywhere without regard to variablescoping rules;
Constants may not be redefined or undefined once they havebeen set; and
Constants may only evaluate to scalar values.
The name of the constant is given by name;the value is given by value.
The optional third parametercase_insensitive is also available.If thevalue 1 is given, then the constant will bedefined case-insensitive.The default behaviour iscase-sensitive; i.e.CONSTANT and Constant represent differentvalues.
Example 1.Defining Constants
<?phpdefine ("CONSTANT", "Hello world.");echo CONSTANT; // outputs "Hello world."?>
Define() returns TRUE on success and FALSE ifan error occurs.
See also defined() and the section on Constants.defined (PHP3 , PHP4 )defined -- Checks whether a given named constant existsDescriptionint defined (string name)
Returns true if the named constant given byname has been defined, false otherwise.
See also define() and the section on Constants.die (unknown)die -- Output a message and terminate the current scriptDescriptionvoid die (string message)
This language construct outputs a message and terminates parsingof the script.It does not return anything.
Example 1.die example
<?php$filename = '/path/to/data-file';$file = fopen ($filename, 'r')or die("unable to open file ($filename)");?>
See also exit().eval (unknown)eval -- Evaluate a string as PHP codeDescriptionvoid eval (string code_str)
eval() evaluates the string given incode_str as PHP code.Among other things,this can be useful for storing code in a database text field forlater execution.
There are some factors to keep in mind when usingeval().Remember that the string passed mustbe valid PHP code, including things like terminating statementswith a semicolon so the parser doesn't die on the line after theeval(), and properly escaping things incode_str.
Also remember that variables given values undereval() will retain these values in the mainscript afterwards.
Example 1.Eval() example - simple text merge
<?php$string = 'cup';$name = 'coffee';$str = 'This is a $string with my $name in it.<br>';echo $str;eval ("\$str = \"$str\";");echo $str;?>
The above example will show:
This is a $string with my $name in it.This is a cup with my coffee in it.exit (unknown)exit -- Terminate current scriptDescriptionvoid exit(void);
This language construct terminates parsing of the script.Itdoes not return.
See also die().func_get_arg (PHP4 >= 4
[ Pobierz całość w formacie PDF ]