Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions data/basics/control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Control Flow

Used for conditions and loops.

## Example
```php
<?php
for($i = 1; $i <= 5; $i++) {
echo $i;
}
?>
Practice

Print numbers from 1 to 10.
18 changes: 18 additions & 0 deletions data/basics/datatypes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Data Types in PHP

- int → integers
- float → decimals
- string → text
- bool → true/false

## Example
```php
<?php
$age = 25;
$price = 9.99;
$name = "John";
$isActive = true;
?>
Practice

Create variables of each type.
13 changes: 13 additions & 0 deletions data/basics/functions/advanced/arrays.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Arrays in PHP

Arrays store multiple values.

## Example
```php
<?php
$arr = array(1,2,3);
echo $arr[0];
?>
Practice

Create an array and print elements.
16 changes: 16 additions & 0 deletions data/basics/functions/advanced/error handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Error Handling

Handles runtime errors.

## Example
```php
<?php
try {
throw new Exception("Error");
} catch(Exception $e) {
echo $e->getMessage();
}
?>
Practice

Handle an exception.
12 changes: 12 additions & 0 deletions data/basics/functions/advanced/ffile handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# File Handling

Read and write files.

## Example
```php
<?php
file_put_contents("file.txt", "Hello");
?>
Practice

Write text to a file.
14 changes: 14 additions & 0 deletions data/basics/functions/advanced/oop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Object-Oriented Programming

Use classes and objects.

## Example
```php
<?php
class Car {
public $name;
}
?>
Practice

Create a class with properties.
13 changes: 13 additions & 0 deletions data/basics/functions/advanced/sessions and cookies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Sessions and Cookies

Used to store user data.

## Example
```php
<?php
session_start();
$_SESSION["user"] = "Ali";
?>
Practice

Store a value in session.
12 changes: 12 additions & 0 deletions data/basics/functions/built in functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Built-in Functions

PHP provides many built-in functions.

## Example
```php
<?php
echo strlen("Hello");
?>
Practice

Use a built-in function to count string length.
14 changes: 14 additions & 0 deletions data/basics/functions/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Functions in PHP

Functions are reusable blocks of code.

## Example
```php
<?php
function greet() {
echo "Hello!";
}
?>
Practice

Create a function that prints your name.
14 changes: 14 additions & 0 deletions data/basics/functions/parameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Parameters

Functions can take arguments.

## Example
```php
<?php
function greet($name) {
echo $name;
}
?>
Practice

Create a function that takes two numbers and prints sum.
15 changes: 15 additions & 0 deletions data/basics/functions/recursion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Recursion

Function calling itself.

## Example
```php
<?php
function factorial($n) {
if($n == 0) return 1;
return $n * factorial($n - 1);
}
?>
Practice

Write recursive sum function.
14 changes: 14 additions & 0 deletions data/basics/functions/return values.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Return Values

Functions can return values.

## Example
```php
<?php
function add($a, $b) {
return $a + $b;
}
?>
Practice

Create a function that returns square of a number.
12 changes: 12 additions & 0 deletions data/basics/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Introduction to PHP

PHP is a server-side scripting language used for web development.

## Example
```php
<?php
echo "Hello, PHP!";
?>
Practice

Print "Welcome to PHP Programming"
16 changes: 16 additions & 0 deletions data/basics/operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Operators in PHP

- Arithmetic: +, -, *, /
- Comparison: ==, !=
- Logical: &&, ||

## Example
```php
<?php
$a = 5;
$b = 3;
echo $a + $b;
?>
Practice

Check if a number is even or odd.
13 changes: 13 additions & 0 deletions data/basics/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Variables in PHP

Variables start with $ symbol.

## Example
```php
<?php
$name = "Ali";
$age = 20;
?>
Practice

Create variables for your name and age.