PHP Tutorials — Scripts, Source Code and Practical PHP Web Development Guides

Flat isometric illustration of a server rack and browser displaying PHP code with PHP badge icon database connection diagram and HTML form in blue

PHP powers a significant portion of the modern web — running WordPress, Drupal, Laravel and countless custom web applications that serve billions of users daily. As a server-side scripting language designed specifically for web development, PHP offers a practical, accessible entry point into backend programming while remaining powerful enough for large-scale enterprise applications and high-traffic websites.

MYCPLUS has been publishing PHP tutorials and web development guides since 2004. This section covers PHP scripting from the fundamentals through to practical source code examples you can drop directly into your own web projects. You will find clear explanations of core PHP syntax and programming principles, practical scripts for common web development tasks including form handling, database connectivity, file operations and session management, along with real-world source code examples that demonstrate how PHP is used in professional web development.

Whether you are a beginner writing your first PHP script, a web developer building dynamic websites, or a programmer looking to extend your backend development skills — this section gives you the practical PHP resources to build server-side web applications with confidence. Every example is designed for immediate real-world use.

What You’ll Learn

  • PHP scripting fundamentals — variables, data types, control flow, functions, arrays and the core PHP programming model with practical server-side examples
  • Working with forms and user input — handling HTML form submissions, validating and sanitising user input, processing POST and GET requests and building secure PHP forms
  • Database connectivity with PHP — connecting to MySQL databases, executing queries, fetching results, prepared statements and building data-driven web applications with PHP and MySQL
  • File handling and operations — reading and writing files, uploading user files, managing directories and practical PHP file system operations for web applications
  • Session and cookie management — implementing user sessions, managing authentication state, working with cookies and building secure login systems in PHP
  • PHP source code examples — ready-to-use PHP scripts covering common web development tasks, utility functions, API integrations and practical server-side programming patterns

Why MYCPLUS: Trusted by PHP developers and web programmers since 2004 — every tutorial includes working PHP source code and practical scripts designed for real-world server-side web development.

php mail function

How to Send Email using PHP

A detailed guide on PHP mail sending options with examples of using the built-in mail function(), PHPMailer, Symfony, and third-party mail service providers such as Amazon SES, SendGrid and GetResponse.

Oracle PHP Connectivity

How to use PHP with Oracle Database 11g

This source code shows you how to connect to Oracle Database 11g and execute queries using the PHP. First of all it sets the ORACLE_HOME and ORACLE_SID Environment variables using the putenv() method. Note that to run this code, you will need PHP OCI8 extension enable in php.ini file.

random numbers

Printing numbers within a range in PHP

The following PHP source code shows that how to print random numbers within a range using. It uses rand() function to return the random numbers within a predefined range. The srand() function is used to provide the seed or arbitrary int number.

Connect to sFTP Server in PHP

Connect to sFTP Server in PHP

To use SFTP within your PHP application, a series of fundamental steps need to be executed. First and foremost, you must establish a connection to the SFTP server by utilizing the ssh2 extension, which facilitates secure communication. Subsequently, authentication is crucial to ensure the identity of the connecting entity. This is achieved by providing valid credentials, including a username and password, to the SFTP server. Once authenticated, your PHP script gains access to the server and enables file-related operations such as listing directory contents, downloading files to the local environment, and uploading files to the remote server.

Search the LDAP Directory in PHP

Search the LDAP Directory in PHP

This PHP code connects to an LDAP server, performs a search for entries with the last name and then sorts and prints them alphabetically. The sorting is done by a custom function called compareEntry, which compares entries based on last names and first names. It uses the LDAP functions to communicate with the server and showcases basic error handling.

Get Detailed Server Information in PHP

Get Detailed Server Information in PHP

Welcome to the PHP Server Information Script – a robust script designed to provide valuable insights into your server environment. This script offers a overview of key aspects such as PHP memory usage, system memory details, and OS/Web Server information.

PHP-MySQL Database Table Structure Viewer

PHP/MySQL Database Table Structure Viewer

The script uses MySQLi, a modern and more secure extension for interacting with MySQL databases in PHP. It provides a beginner-friendly way to understand the composition of your database tables. The script connects to the database, query the structure of a specific table and presents the information in an organized HTML format.

Block a Specific IP Address in PHP

Block a Specific IP Address in PHP

In this article, we’ll explore how to block a specific IP address or a list of addresses from accessing a webpage using PHP. By leveraging PHP’s capabilities, you can fortify your web applications against unauthorized access and potential security threats. Let’s delve into the process of implementing IP-based access restrictions to bolster the security of your PHP-powered webpages.

Scroll to Top