
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1060 Articles for PHP

6K+ Views
Yes, HTML can be embedded inside an ‘if’ statement with the help of PHP. Below are a few methods.Using the if condition − it is displayed iff $condition is met Using the if and else if conditions − it is displayed iff $condition is met HTML TAG HERE HTML TAG HERE Embedding HTML inside PHP − HTML TAG HERE

1K+ Views
A search engine directory of the spider names can be used as a reference. Next, $_SERVER['HTTP_USER_AGENT']; can be used to check if the agent is a spider (bot).Below is an example demonstrating the same −if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "some_bot_name")) { //other steps that need to be used }Code explanation − The agent, along with the user agent is passed to the strtolower function, whose output in turn is passed to the strstr function. Both the user agent and the bot are compared to see if the spider is a bot or not.Another option is shown below −function _bot_detected() { return ( ... Read More

910 Views
Yes, an object can be instantiated and a method can be called on a single line using PHP. This feature has come into effect beginning from PHP version 5.4.An object can be instantiated by accessing the class member of the class. This can be seen in the below snippet −(new my_var)-> my_instance()Code explanation − Here, my_instance is the method and my_var is the object that needs to be instantiated.Example Live Democlass Test_class { public function __construct($param) { $this->_var = $param; } public function my_method() { return $this->_var * 2; } ... Read More

636 Views
Since can’t be used with single quotes, we need to resort to other options.When using command line interface, the constant PHP_EOL can be used.When using with browsers, the ‘’ can be used.Both the options have been demonstrated below.Suppose our option was not cli, the ‘else’ part will be executed and a newline will be printed −Example Live DemoOutputThis will produce the following output −hi hello hihello

234 Views
If there are two nested loops, the break statement can be used −break 2;Below is a demonstration with the foreach loop −foreach(...) { foreach(...) { if (my_var_1.name == my_var_2) break 2; //it breaks out of the outermost foreach loop } }For PHP version>=5.3, the below lines of code can be used −foreach (...) { foreach (...) { if (my_var_1.name == my_var_2) goto top; } } top:

486 Views
In this article, we will learn about how to upgrade and update PHP 5.x to PHP 7, PHP 7 which was released in 2015 with speed improvements comparable to the older versions of the PHP.PrerequisitesAssuming that we have already installed PHP 5.x on CentOS7, and mod_php module should be enabled by Apache, and we need Sudo privileges or root user.Enabling the PHP 7 RepositoryAs PHP 7.x is not available in the official repositories, so we need to use IUS community Project Repository.Download the IUS repository in the machine with the below command# curl 'https://setup.ius.io/' -o setup-ius.sh curl 'https://setup.ius.io/' -o setup-ius.sh ... Read More

591 Views
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group. The latest version PHP is PHP7 and it provides 2x faster performance and 50% better memory consumption than PHP version 5.6. This article explains “How to install PHP7 on Ubuntu Linux”.Before installing PHP7, you should need to install a PPA called ondrej/php. This allows you to co-install PHP versions 5.6 and 7.0.Configuring a PPA for co-installable PHP 5.6 + 7.0To configure a PPA, use ... Read More

215 Views
Magento is a fastest growing open source eCommerce platform that uses MySQL and Zend PHP databases. Magento is a very flexible eCommerce platform that facilitates powerful marketing, Management of multiple websites, catalogue management, and integration of Google Website Optimizer and over 50 payment gateways. It gives the flexibility for the users to control the content, look and functionality of the ecommerce.Magento was originally developed by Varien Inc., a US private company in California. Today, some of their largest users are Burger King, Nestle, Murad, BevMo, and Coca-Cola. Magento open source CMS platform provides increased control in terms of merchandising to ... Read More

495 Views
$ operatorOperator is used to define variables in php. For example, message. Such variables can contain any type of value like int, string, etc.$$ operator$$ is a special operator that contains the name of another variable and can be used to access the value of that variable.ExampleFollowing the example, shows the usage of '′vs′$' operators. Live Demo PHP Example Outputmessage Welcome to Tutorialspoint

429 Views
'AND' Logical operator'AND' operator is a logical AND operator but has low precedence to = operator.'&&' Logical operator'&&' is also a logical AND operator but has high precedence to = operator.ExampleFollowing the example, shows the difference of 'AND' vs '&&' operators. Live Demo PHP Example Output$result = $x AND $y bool(true) $result = $x && $y bool(false)