PHP is a programming and scripting language to create dynamic interactive websites. WordPress is written using PHP as the scripting language. Just like WordPress, PHP is also an Open Source.
PHP is a server side programming language. When a user requests a web page that contains PHP code, the code is processed by the PHP module installed on that web server. The PHP pre-processor then generates HTML output to be displayed on the user’s browser screen.
Example of a simple PHP code:
<?php
echo "Hello, World!";
?>
In WordPress PHP files usually have a .php
extension. PHP can be used inside HTML documents. The PHP pre-processor only processes code inside the php opening tag <?php
and the closing tag ?>
.
Example of PHP code inside an xHTML document.
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php bloginfo( 'name' ); ?></title>
</head>
A WordPress user does not need to learn PHP in order to use, run, or manage a WordPress powered website.
Most users can use WordPress without ever learning to program or code in PHP. However, if a user wants to develop WordPress themes, plugins, or modify default behavior of WordPress by using actions and filters, then they would need to learn the basic syntax of PHP along with HTML and CSS.
This post was originally published in the wpbeginner glossary.