Online Tutorials & Training Materials | STechies.com
Register Login

PHP

Introduction to PHP

PHP stands for Hypertext Processor and is a very powerful, open-source and popular server-side scripting language that is used by developers to create dynamic and interactive web pages. The programming language allows developers to form content that can interact with different databases and is used to develop web-based software applications. The popular programming language is used by the tech giants like Google, Facebook and Yahoo and can be embedded into other front-end technologies like HTML.

Prerequisites to Learn PHP

There is no rule of thumb as to what one should already know before learning PHP. It is advisable to have a basic understanding of the front-end technologies like HTML and CSS in order in order to offer a seamless user experience on a responsive platform. Since PHP serves to establish a connection between content and database, an understanding of the database management system and software like MySQL will also useful.

Even though it is totally optional, a proper understanding of the programming languages like Java, C and C++ can accelerate the process of learning PHP. PHP has the functional units like loops and arrays and thus having even a basic knowledge of the programming languages will obviously help.

Uses of PHP

PHP is a very powerful and a very versatile programming language that can serve a lot of different purposes.

Server-side Scripting: This is the main function of PHP and a developer needs three things to perform it. The developer needs a one PHP parser to convert a human-readable language to a computer-readable form, a web server to execute the files forming the web pages and a web browser to exhibit content or access the program output.

Command-line Scripting: You can execute or run a PHP script without a web browser or a web server and using just a PHP parser. This function of PHP is normally used for simpler text processing tasks.

Desktop Application Development: Another function of PHP is to create client-side applications. Such applications typically have graphical user interfaces. Advanced PHP features can be used to develop such applications.

Graphic Design and Image Processing: PHP scripts are also used for manipulating image content along with text content. Different image processing libraries like ImageMagick, GD Library and Imagine can be integrated into PHP applications that can then manipulate the images.

Characteristics of PHP

PHP is one of the most widely used server-side scripting languages because of the efficient, quick and practical nature of its services.

  • Open Source: Unlike many programming languages, this is an open-source language that can be redistributed and modified freely.
  • Cross Platform: PHP is compatible with all leading web browsers and operating systems like Linux, Unix, MAC OS, Windows, Solaris. This feature of the software easy deployment of various applications across different browsers and operating systems.
  • Fast Performance: PHP scripts can be executed much faster than the ones written in any other scripting language such as JSP or ASP.NET.
  • Simple, Interpreted and Efficient: PHP is very easy to use and even beginners do not need much time to get the hang of it. PHP is an interpreted programming language that does not require compilation. PHP is efficient enough to be used in a multiuser environment. It supports object-oriented programming, has specific features for session management and reference counting and others.

What is a PHP shell?

PHP Shell is a script or program written in PHP (Php Hypertext Preprocessor) which provides us with Linux Terminal (Shell is a vast concept) in Browser. PHP Shell allows user to execute most of the shell commands in browser, some cannot be executed due to PHP limitations.

Basic PHP Syntax

We can insert PHP script or code anywhere in the document. A PHP script or code starts with <?php and ends with ?>:

<?phpPHP code goes here?>

For Example (PHP Hello World):

<?phpecho "Hello World!";?>

 


Tutorials

  • How to display PDF/Word File in browserHow to display PDF/Word File in browser
    In my current project I don't want to keep PDF and DOC file on server or open due to security purpose so I want a system where only login user can view or download the files. so to do this have us ...

  • PHP and SAP integration Requirments
    Only three things required for PHP and SAP integration.Apache HTTP ServerPHP version 4 or 5SAPRFC for PHPSetting PHPRC VariablDocumentRoot "T:/websites"SetEnv PHPRC T:/apache/phpSet my scrip ...

  • Disable form autofill in Chrome for Email and Password autocomplete
    I want to disable form autofill in Google Chrome browser.  The autocomplete="off" tag wont work now. To do this you need to create a extra field with the name email and passw ...

  • How to Solve PHP Notice: Undefined Index?How to Solve PHP Notice: Undefined Index?
    Undefined index is a 'notice' such as following: “Notice: Undefined variable”,  “Notice: Undefined index”, and “Notice: Undefined offset” As y ...

  • How to Display Alert Message Box in PHP?How to Display Alert Message Box in PHP?
    JavaScript has three types of pop-up boxes, which are the following: Alert box Confirm box Prompt box In this article, you will learn about the alert box, confirmation box, and prompt b ...

  • How to Call a JavaScript Function from PHP?How to Call a JavaScript Function from PHP?
    PHP is a server-side programming language which means it executes at the server end and it will return the HTML code. On the other hand, Javascript is client-side (runs at client browser) scripting la ...

  • in_array in PHP
    Definition PHP in_array() is an inbuilt PHP function which is used to check if a specific value exists in an Array or not.  Syntax in_array ($value, $array, $type) Parameters ...

  • PHP Filter_var () Function
    What is filter_var? filter_var() is a PHP function used to filters a variable with the help of a specified filter. In PHP programming language we can use filter_var() function to validate and ...

  • array_push() function in PHP
    array_push() in PHP Php array_push() function is used to push(add) one or more new elements onto the end of the array. Due to the addition of these new elements, the length of the array increases b ...

  • strpos() Function in PHP
    PHP strpos() function The strpos() function in php is used to find the first occurrence of a substring in a string. it returns numerical value of the position of the first occurrence of the string ...

  • PHP file_get_contents
    The file_get_contents() is an inbuilt PHP function used to read file into a string. This function uses the memory mapping technique to enhance the performance, and therefore, this function is the most ...

  • Call To Undefined Function Mysql_connect() error in PHP 7
    After upgrading  to  PHP 7 from PHP 5, I start getting  error PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() This is because mysql_* functions are co ...

  • Your PHP installation appears to be missing the MySQL extension, which is required by WordPress.
    If the following error occurred, which means there is some problem with your PHP version or MySql extension. Your PHP installation appears to be missing the MySQL extension, which is required by Wo ...

  • How to Call PHP Function from JavaScript?
    As we all know that Javascript is client level scripting language and PHP is Server level programming language. In this tutorial we aim to throw light on how to call PHP function from Javascript with ...

  • How to count array length in PHP
    count() function in PHP PHP count() function is an in-built function available in PHP, which counts and returns the number of elements in an array. It also counts the number of properties in an obj ...

  • PHP strtotime() function
    PHP strtotime() function is an in-built php function which is used to convert the English textual datetime into Unix timesmap datetime (number of seconds since January 1 1970 00:00:00 GMT).  I ...

  • Merge Two Arrays in PHP
    PHP array_merge() Function PHP array_merge function is an in-built function in PHP, which is used to merge or combine one or multiple arrays into one single array. This function adds elements ...

  • PHP implode() Function
    Description The implode() function is a binary-safe function in PHP, which used to join elements of an array. It merges all the elements of an array and returns a string.  Syntax implo ...

  • PHP explode() Function
    Description The explode() function is a binary-safe function in PHP, which used to break a string into an array. It breaks the string in various elements and returns them in a form array.  ...

  • PHP move_uploaded_file() Function
    Description The move_uploaded_file() is a PHP function that is used to move an uploaded file to a new destination. Notes: Before moving the uploaded file to a new location, this function f ...