Skip to content

Commit 3064e95

Browse files
committed
php basics docs added
1 parent 7a8a1f8 commit 3064e95

File tree

8 files changed

+512
-0
lines changed

8 files changed

+512
-0
lines changed

docs/PHP/_category.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "PHP",
3+
"position": 13,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "PHP is a popular server-side scripting language known for its versatility and ease of use in web development. It is widely used for creating dynamic web pages, handling forms, interacting with databases, and building web applications. Key features of PHP include a large library of built-in functions, support for various databases like MySQL, PostgreSQL, and SQLite, integration with web servers like Apache and Nginx, and frameworks like Laravel, Symfony, and CodeIgniter. PHP is an essential tool for building dynamic and interactive websites."
7+
}
8+
}

docs/PHP/home.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
id: php-tutorial
3+
title: PHP - Home
4+
sidebar_label: PHP - Home
5+
sidebar_position: 1
6+
tags: [PHP, web development, server-side scripting, programming languages]
7+
description: Learn about PHP, an open-source scripting language widely used for web development, server-side scripting, and building dynamic web applications.
8+
---
9+
10+
# PHP Tutorial
11+
12+
## What is PHP?
13+
14+
PHP is an open-source general-purpose scripting language widely used for website development. It is developed by Rasmus Lerdorf. PHP stands for a recursive acronym PHP: Hypertext Preprocessor.
15+
16+
PHP is the world’s most popular server-side programming language. Its latest version PHP 8.2.8 was released on July 4th, 2023.
17+
18+
PHP is a server-side scripting language embedded in HTML. It is cross-platform, capable of running on all major operating systems and most web server programs such as Apache, IIS, lighttpd, and nginx.
19+
20+
A large number of reusable classes and libraries are available on PEAR and Composer. PEAR (PHP Extension and Application Repository) is a distribution system for reusable PHP libraries or classes. Composer is a dependency management tool in PHP.
21+
22+
### Why Learn PHP?
23+
24+
PHP is one of the most preferred languages for creating interactive websites and web applications. PHP scripts can be easily embedded into HTML. With PHP, you can build:
25+
26+
- Web Pages and Web-Based Applications
27+
- Content Management Systems
28+
- E-commerce Applications, etc.
29+
30+
Several PHP-based web frameworks have been developed to speed up web application development. Examples include WordPress, Laravel, Symfony, etc.
31+
32+
### Advantages of Using PHP
33+
34+
PHP is a MUST for students and working professionals to become great Software Engineers, especially when they are working in the Web Development Domain.
35+
36+
Some notable advantages of using PHP are:
37+
38+
- Multi-paradigm language supporting imperative, functional, object-oriented, and procedural programming methodologies.
39+
- Integrated with popular databases including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
40+
- Zippy in execution, especially when compiled as an Apache module on the Unix side.
41+
- Supports a number of protocols such as POP3, IMAP, and LDAP.
42+
- Forgiving with a familiar C-like syntax.
43+
- Practical nature characterized by Simplicity, Efficiency, Security, Flexibility, and Familiarity.
44+
45+
### Hello World Using PHP
46+
47+
```php
48+
<?php
49+
echo "Hello, World!";
50+
?>
51+
```
52+
53+
### Audience
54+
55+
This PHP tutorial is designed for programmers completely unaware of PHP concepts but with a basic understanding of computer programming.
56+
57+
### Prerequisites
58+
59+
Before proceeding with this tutorial, you need a basic understanding of computer programming. Knowledge of HTML, CSS, JavaScript, and databases is an added advantage.
60+
61+
<details>
62+
<summary>Frequently Asked Questions about PHP</summary>
63+
64+
1. Do I Need Prior Programming Experience to Learn PHP?
65+
2. Is PHP Free to Use?
66+
3. What are the Applications of PHP?
67+
4. How Do I Install PHP?
68+
5. What Tools and Technologies Work Well with PHP?
69+
6. Can PHP Be Used for Both Frontend and Backend Development?
70+
7. Are There Security Concerns with PHP?
71+
8. What Are the Latest Features and Updates in PHP?
72+
9. How Long Will it Take to Master PHP?
73+
10. What Resources Do I Need to Learn PHP?
74+
75+
</details>
76+
77+
```mermaid
78+
graph LR
79+
A[PHP] -- is --> B[Open-source]
80+
A -- used for --> C[Website Development]
81+
C -- embedded in --> D[HTML]
82+
C -- runs on --> E[Major Operating Systems]
83+
C -- integrates with --> F[Web Servers and Databases]
84+
```

docs/PHP/php-features.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
id: php-features
3+
title: PHP - Features
4+
sidebar_label: PHP - Features
5+
sidebar_position: 5
6+
tags: [PHP, features, programming languages, server-side scripting]
7+
---
8+
9+
# PHP - Features
10+
11+
PHP (Hypertext Preprocessor) is an open-source server-side scripting language primarily used for web development. Let's explore some of its key features:
12+
13+
## PHP Features
14+
15+
### Simple and Easy to Learn
16+
17+
PHP has a syntax that's simpler compared to languages like C, Java, and Perl. This makes it easier for developers, especially those familiar with other languages, to understand and work with. It offers a wide range of pre-defined functions, enabling rapid web application development.
18+
19+
### Open Source
20+
21+
PHP is free and open-source, encouraging a large and active developer community. This community contributes to its development, offers support through forums and tutorials, and shares valuable resources like documentation.
22+
23+
### Cross-Platform Compatible
24+
25+
PHP is compatible with various operating systems (Windows, Linux, macOS, UNIX) and databases (MySQL, PostgreSQL, MongoDB). This cross-platform compatibility allows PHP-based applications to run seamlessly across different environments without modifications.
26+
27+
### Server-Side Scripting
28+
29+
PHP excels in server-side scripting, processing scripts on the web server and delivering HTML to the client's web browser. This facilitates dynamic webpage creation, session management, form handling, and database interactions essential for online applications.
30+
31+
### Database Integration
32+
33+
PHP offers robust support for database interaction, including built-in functions for database connectivity and a database abstraction layer for seamless application-database communication. This makes it easy to develop database-driven web applications.
34+
35+
### Extensive Library Support
36+
37+
PHP provides extensive libraries for various functionalities such as image processing, encryption, PDF generation, XML/JSON parsing, session management, and more. These libraries streamline development and enhance application capabilities.
38+
39+
### Security Features
40+
41+
PHP incorporates security features like data encryption functions (e.g., Sha1, MD5), input validation functions (e.g., filter_var), and secure communication protocols (HTTPS). Third-party security applications further enhance PHP's security capabilities.
42+
43+
### Memory and Session Management
44+
45+
PHP ensures efficient memory management and session handling, optimizing performance and resource utilization. Its code runs in its memory space, leading to faster execution compared to other scripting languages.
46+
47+
### Active Community and Support
48+
49+
With a vibrant developer community, PHP receives continuous updates, support, and contributions. Developers can easily seek help, share knowledge, and collaborate on projects, ensuring PHP remains modern, secure, and well-supported.
50+
51+
:::note
52+
Explore the [PHP Manual](https://www.php.net/manual/en/) for detailed documentation and guides on PHP features.
53+
:::
54+
55+
## PHP Features Diagram
56+
57+
```mermaid
58+
graph TD
59+
A(Simple and Easy to Learn) --> B(Open Source)
60+
B --> C(Cross-Platform Compatible)
61+
C --> D(Server-Side Scripting)
62+
D --> E(Database Integration)
63+
E --> F(Extensive Library Support)
64+
F --> G(Security Features)
65+
G --> H(Memory and Session Management)
66+
H --> I(Active Community and Support)
67+
```

docs/PHP/php-hello-world.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
id: php-hello-world
3+
title: PHP - Hello World
4+
sidebar_label: PHP - Hello World
5+
sidebar_position: 7
6+
tags: [PHP, hello world, web development, XAMPP]
7+
---
8+
9+
# PHP - Hello World
10+
11+
## Introduction
12+
13+
The "Hello World" program is a common starting point for beginners learning a new programming language. Let's dive into creating a simple "Hello World" program in PHP using XAMPP.
14+
15+
## Prerequisites
16+
17+
Ensure that you have XAMPP installed, which includes the Apache server and PHP module.
18+
19+
## Writing and Running the Program
20+
21+
1. Open your preferred text editor.
22+
2. Save the following code as `hello.php` in the `htdocs` directory of your XAMPP installation.
23+
24+
```php
25+
<?php
26+
echo "Hello World!";
27+
?>
28+
```
29+
30+
3. Start the Apache server from the XAMPP control panel if it's not already running.
31+
4. Open a new tab in your browser and enter `http://localhost/hello.php` as the URL.
32+
5. You should see the "Hello World" message displayed in the browser window.
33+
34+
## Mixing HTML with PHP
35+
36+
You can mix HTML and PHP code in a single script. For example:
37+
38+
```php
39+
<!DOCTYPE html>
40+
<html>
41+
<body>
42+
<h1>My PHP Website</h1>
43+
<?php
44+
echo "Hello World!";
45+
?>
46+
</body>
47+
</html>
48+
```
49+
50+
The "Hello World" message will be rendered as plain text, but you can include HTML tags inside the PHP code for formatting.
51+
52+
## Running PHP Scripts from Command Prompt
53+
54+
You can also run PHP scripts from the command prompt. Assuming you have a `hello.php` file with the following content:
55+
56+
```php
57+
<?php
58+
echo "Hello PHP!!!!!";
59+
?>
60+
```
61+
62+
1. Add the path of the PHP executable (e.g., `php.exe` in XAMPP) to your operating system’s path environment variable.
63+
2. Open a command prompt and navigate to the directory containing `hello.php`.
64+
3. Run the script using the command:
65+
66+
```bash
67+
php hello.php
68+
```
69+
70+
You will see the output:
71+
72+
```
73+
Hello PHP!!!!!
74+
```
75+
76+
:::note
77+
Ensure that XAMPP is properly configured and the Apache server is running to execute PHP scripts.
78+
:::

docs/PHP/php-history.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
id: php-history
3+
title: PHP - History
4+
sidebar_label: PHP - History
5+
sidebar_position: 4
6+
tags: [PHP, history, programming languages, versions]
7+
---
8+
9+
# PHP - History
10+
11+
PHP started as a small open-source project that gradually evolved as more people discovered its usefulness. Here's a brief overview of its history and major milestones:
12+
13+
## Early Days
14+
15+
Rasmus Lerdorf released the first version of PHP in 1994. Originally, PHP stood for "Personal Home Page" as it was used to maintain his personal homepage. Over time, database support was added, and it became known as "Personal Home Page/Forms Interpreter" or PHP/FI, capable of building dynamic web applications.
16+
17+
## PHP 3 and Beyond
18+
19+
In 1997, Zeev Suraski and Andi Gutmans rewrote the parser, laying the foundation for PHP 3. The language was renamed to PHP: Hypertext Preprocessor, reflecting its recursive nature. The Zend Engine, a compiler and runtime environment for PHP, powered PHP 4 released in May 2000.
20+
21+
## PHP 5
22+
23+
PHP 5, released in 2004, introduced significant features like Object-Oriented Programming (OOP) support, PHP Data Objects (PDO), and performance enhancements.
24+
25+
## PHP 7
26+
27+
PHP 7, developed in 2015, brought new language features including return type declarations and scalar types in parameter and return type declarations.
28+
29+
## PHP 8
30+
31+
PHP 8, the latest major version released in November 2020, introduced notable features such as Just-in-time (JIT) Compilation, the "match" expression, union types, mixed type, static return type, and attributes for adding metadata to PHP classes.
32+
33+
:::note
34+
Explore the [PHP Manual](https://www.php.net/manual/en/) for detailed documentation and guides on PHP versions and features.
35+
:::
36+
37+
## Major Version Timeline
38+
39+
Here's a summary of important milestones in PHP's release history:
40+
41+
| Version | Description |
42+
| ------- | ----------- |
43+
| 1.0 | (8 June 1995) Officially called "Personal Home Page Tools (PHP Tools)". |
44+
| 2.0 | (1 November 1997) Officially called "PHP/FI 2.0". |
45+
| 3.0 | (6 June 1998) Development expanded to multiple developers. |
46+
| 4.0 | (22 May 2000) Introduced Zend Engine. |
47+
| 5.0 | (13 July 2004) Zend Engine II with new features. |
48+
| 5.1 | (24 November 2005) Performance improvements and PDO introduction. |
49+
| 6.x | Not released. Abandoned version with native Unicode support plan. |
50+
| 7.0 | (3 December 2015) Zend Engine 3, new syntax, and features. |
51+
| 7.3 | (6 December 2018) Flexible Heredoc/Nowdoc syntax. |
52+
| 8.0 | (26 November 2020) JIT compilation, new operators, and types. |
53+
54+
```mermaid
55+
graph LR
56+
A[PHP 1.0] --> B[PHP 2.0]
57+
B --> C[PHP 3.0]
58+
C --> D[PHP 4.0]
59+
D --> E[PHP 5.0]
60+
E --> F[PHP 5.1]
61+
F --> G[PHP 6.x]
62+
G --> H[PHP 7.0]
63+
H --> I[PHP 7.3]
64+
I --> J[PHP 8.0]
65+
```

docs/PHP/php-installation.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
id: php-installation
3+
title: PHP - Installation
4+
sidebar_label: PHP - Installation
5+
sidebar_position: 3
6+
tags: [PHP, web development, server-side scripting, programming languages, XAMPP]
7+
---
8+
9+
# PHP - Installation
10+
11+
You can start learning the basics of programming in PHP with the help of any of the online PHP compilers freely available on the Internet. This will help in getting acquainted with the features of PHP without installing it on your computer. Later on, install a full-fledged PHP environment on your local machine.
12+
13+
One such online PHP compiler is provided by Tutorialpoint’s "Coding Ground for Developers". Visit [Tutorialspoint Coding Ground](https://www.tutorialspoint.com/codingground.htm), enter PHP script and execute it.
14+
15+
## PHP Installation
16+
17+
However, to be able to learn the advanced features of PHP, particularly related to the web concepts such as server variables, using backend databases, etc., you need to install the PHP environment on your local machine.
18+
19+
In order to develop and run PHP Web pages, you need to install three vital components on your computer system:
20+
21+
1. **Web Server:** PHP will work with virtually all Web Server software, including Apache, NGINX, or Lighttpd. The most often used web server software is the freely available Apache Server. [Download Apache](https://httpd.apache.org/download.cgi)
22+
23+
2. **Database:** PHP will work with virtually all database software, including MySQL, Oracle, and Sybase. The most commonly used is the freely available MySQL database. [Download MySQL](https://www.mysql.com/downloads/)
24+
25+
3. **PHP Parser:** In order to process PHP script instructions, a parser must be installed to generate HTML output that can be sent to the Web Browser.
26+
27+
Although it is possible to install these three components separately and configure the installation correctly, it is a little complex process, particularly for beginners. Instead, using any all-in-one packaged distribution that contains precompiled Apache, MySQL, and PHP binaries is convenient.
28+
29+
## XAMPP Installation
30+
31+
One popular all-in-one solution is XAMPP, from Apache Friends. It includes Apache, MariaDB (a fork of MySQL), PHP, and Perl. XAMPP is cross-platform, available for Windows, Linux, and OS X.
32+
33+
To download XAMPP, visit the [Apache Friends website](https://www.apachefriends.org/download.html) and download the installer for your operating system.
34+
35+
### Windows Installation
36+
37+
1. Download the installer from [SourceForge](https://sourceforge.net/projects/xampp/).
38+
2. Run the installer and follow the wizard-based installation.
39+
3. Provide administrator access and choose the installation directory (default is "c:\xampp").
40+
41+
### Linux Installation
42+
43+
1. Change the permissions to the installer:
44+
45+
```bash
46+
chmod 755 xampp-linux-*-installer.run
47+
```
48+
49+
2. Run the installer:
50+
51+
```bash
52+
sudo ./xampp-linux-*-installer.run
53+
```
54+
55+
3. XAMPP is installed in "/opt/lamp" directory.
56+
57+
### OS X Installation
58+
59+
1. Open the DMG image and double-click the image to start the installation process.
60+
2. Start XAMPP using the XAMPP Control Panel.
61+
62+
For detailed instructions on managing servers and PHP with XAMPP, refer to the XAMPP documentation.

0 commit comments

Comments
 (0)