Skip to main content

Advanced PHP

This segment will concentrate on some progressed PHP points, which will engage the per user to make dynamic web pages.

 A global variable is a variable declared at the top of the script outside the function. This variable is available to the complete script. Superglobal variables are arrays built into PHP. These superglobal variables are populated automatically with useful elements, and they are available in any scope. A superglobal array can be accessed within a function or a method without using the global keyword.

PHP Superglobals

  • $_COOKIE – It contains values provided to the script via HTTP cookies.
  • $_GET – It contains variables submitted to the script using HTTP get method. 
  • $_POST – It contains variables submitted to the script using HTTP post method. 
  • $_REQUEST – It is a combined array containing values from the $_GET, $_POST, and $_COOKIES superglobal arrays. 
  • $_ENV – It contains keys and values set by the script’s shell. 
  • $_FILES – It contains information about uploaded files. 
  • $_SERVER – It contains variables made available by the server. 
  • $GLOBALS – It contains all the global variables associated with the current script.

Instanceof Operator
The instanceof operator in PHP is used to determine whether a given object, the parents of that object, or its implemented interfaces are of a specified object class.
Example
<?php
class X { }
class Y { }
$thing = new X;
if ($thing instanceof X) {
echo 'X';
}
if ($thing instanceof Y) {
echo 'Y';
}
?>

Declare
The declare statement is used to set execution directives for a block of code. The syntax of the declare statement is similar to the syntax of other flow control statements.
Syntax
declare (directive)
statement

The directive section allows the behavior of the declare block to be set. In this only one directive is recognized, which is the ticks directive.
[Ticks - A tick is an event that occurs for every N low level statements, which are executed within the declare block. The value of N is specified using the statement ticks = N in the directive section.]
The statement partof the declare block will be executed according to the directives set in the directive block.
Example
<?php
// how to use declare:
// the first way:
declare(ticks=1) {
// entire script here
}
// the second way:
declare(ticks=1);
// entire script here
?>

For  more information, please visit: http://www.osglsofttech.com
Call: +91-8650030309, +91-8650030308

Address : TBI-GEU, 566/6 Bell Road, Clement Town, Dehradun-248002
Headoffice : 131, First Floor, PKT-9, Sector-5, North-East Delhi-110085

Comments

Popular posts from this blog

Why use an Inventory Management System?

Inventory management   software is a computer-based   system  for tracking   inventory  levels, orders, sales and deliveries. It can also be   used  in the manufacturing industry to create a work order, bill of materials and other production-related documents. Inventory  control is also  important  to maintaining the right balance of stock in your warehouses. You don't want to lose a sale because you didn't have enough  inventory  to fill an order. ... Too much  inventory  can trigger profit losses––whether a product expires, gets damaged, or goes out of season. ·          Real-Time Inventory by Category & Location Real time inventory provides comprehensive information’s in a format you currently use within a minute of the physical audit to be completed.   Real-Time Inventory   Control Software package allows you to manage all aspects of you...

मां को पसंद हैं ये 9 भोग, जानेंं नवरात्रि के किस दिन क्या चढ़ाएं...

नवरात्रि पर देवी पूजन और नौ दिन के व्रत का बहुत महत्व है. मांदुर्गा के नौ रूपों की अाराधना का पावन पर्व शुरू हो चुका है. इन नौ दिनों मेंव्रत रखने वालों के लिए कुछ नियम होते हैं साथ ही इन नौ दिनों में मां दुर्गा के नौ स्वरूपों कोउनका पसंदीदा भोग चढ़ाकर मां का आशीर्वाद भी पाया जासकता है.आइए जानें, नौ तिथि और नौदेवियों को किस दिन क्या भोग चढ़ाएं... 1. मां शैलपुत्रीमां शैलपुत्री को सफेद चीजों का भोग लगाया जाता है और अगर यह गाय के घी में बनी हों तो व्यक्ति को   रोगों से मुक्ति   मिलती है और हर तरह की बीमारी दूर होती है. 2. मां ब्रह्मचारिणी मां ब्रह्मचारिणी को मिश्री , चीनी और पंचामृत का भेग लगाया जाता है. इन्हीं चीजों का दान करने से लंबी आयु का सौभाग्य भी पाया जा सकता है. 3. मां चंद्रघंटा मां चंद्रघंटा को दूध और उससे बनी चीजों का भोग लगाएं और और इसी का दान भी करें. ऐसा करने से मां खुश होती हैं और सभी दुखों का नाश करती हैं. 4. मां कुष्मांडा मां कुष्मांडा को मालपुए का भोग लगाएं. इसके बाद प्रसाद को किसी   ब्राह्मण को ...

With hundreds of programming languages already in existence, why invest the considerable effort in creating a new one?

For developers of three newfangled open source languages -- Coconut, Crystal, and Oden -- the answer is simply that, in programming, there are always new niches to fill and new needs to be met.  Recently, however, many programmers have begun experimenting with more tailored programming languages, which are designed for more specific purposes and intended to extend these existing and well-known languages. •  Crystal: Bringing existing languages’ features into focus Crystal’s main developer Ary Borenszweig not only acknowledges the wealth of programming languages already in existence, he builds on their best features. Crystal is a language that almost serves as a consolidator. It has been designed to bring together the best features of numerous other languages, thereby intending to bring the “best of the best” into a single design. Some of the features of Crystal include static type-checking, which facilitates rapid design. Automatic memory management and native compi...