Q.Suppose that you have to implement a class named Dragonball. This class must have an attribute named ballCount (which starts from 0) and a method iFoundaBall. When iFoundaBall is called, ballCount is increased by one. If the value of ballCount is equal to seven, then the message You can ask your wish is printed, and … Continue reading PHP OOPS
PEAR is an acronym for “PHP Extension and Application Repository” The purpose of PEAR is to provide: A structured library of open-sourced code for PHP users A system for code distribution and package maintenance A standard style for writing code in PHP PHP Foundation Classes (PFC) PHP Extension Community Library (PECL)
Magic methods are member functions that are available to all the instance of class. Magic methods always start with “__”. Eg. __construct. All magic methods need to be declared as public To use a method, it should be defined within the class or program scope Various Magic Methods used in PHP 5 are: __construct() __destruct() … Continue reading PHP MAGIC METHODS?
Default time allowed for the PHP scripts to execute is 30 secs mentioned in the php.ini file. The function used is set_time_limit(int sec). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec, and 20 sec is specified in set_time_limit(), the … Continue reading How can we increase the execution time of a PHP script?
A stored procedure is a set of Structured Query Language (SQL) statements with an assigned name, which are stored in a relational database management system as a group, so it can be reused and shared by multiple programs. Stored procedures can access or modify data in a database, but it is not tied to a … Continue reading Stored Procedure
$postData = array( "site" => "web technology experts notes", "dailyuser" => "1000", "location" => "India" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.example.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); $output = curl_exec($ch); curl_close($ch); echo $output;
DB Connection Using PDO $host = "localhost"; $username = "root"; $password = ""; $conn = new PDO("mysql:host=$host;dbname=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully";