GithubHelp home page GithubHelp logo

himalayaminds / php-fundamentals Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 2.0 390 KB

Welcome to the PHP Fundamentals repository! This repository is designed to help you learn and practice the basics of PHP programming language.

License: MIT License

PHP 28.82% Hack 0.29% HTML 28.44% CSS 42.46%
open-source php php-basic php-fundamental learn-php

php-fundamentals's Introduction

PHP Fundamentals

Welcome to the PHP Fundamentals repository! This repository is designed to help you learn and practice the basics of PHP programming language.

๐Ÿš€ #PHP #PhpFundamentals #PhpBasic #OpenSource

learn PHP Fundamentals

PHP Basics :

1. Introduction:

  • PHP (Hypertext Preprocessor) is a server-side scripting language widely used for web development.
  • Executed on the server, PHP generates dynamic content before sending it to the browser.

2. Syntax:

  • PHP code is embedded within HTML.
  • Start with <?php and end with ?>.
<?php
   // PHP code here
?>

3. Variables:

In the context of mathematics, computer science, and programming, a variable is a symbolic name or identifier associated with a value that may be changed during the execution of a program. Essentially, it is a storage location (typically in computer memory) paired with an associated symbolic name (an identifier), which contains some known or unknown quantity or information referred to as a "value."

  • Prefix with $.
  • Case-sensitive.
  • No need to declare data types.
$name = "John";
$age = 25;

4. Data Types:

  • Strings, Integers, Floats, Booleans, Arrays, Objects, NULL.

5. Operators:

  • Arithmetic, Assignment, Comparison, Logical, Increment/Decrement.
$x = 10;
$y = 5;
$sum = $x + $y;

Control Structures:

6. Conditionals:

  • if, else, elseif.
$grade = 85;
if ($grade >= 60) {
   echo "Pass";
} else {
   echo "Fail";
}

7. Loops:

  • for, while, do-while, foreach.
for ($i = 0; $i < 5; $i++) {
   echo $i;
}

Functions:

8. Functions:

  • Reusable blocks of code.
  • Defined using function.
function greet($name) {
   echo "Hello, $name!";
}

9. Arrays:

  • Ordered maps.
  • Numerical and associative arrays.
$colors = array("Red", "Green", "Blue");
$info = array("name" => "John", "age" => 30);

File Handling:

10. File Handling:

  • Reading and writing to files.
$file = fopen("example.txt", "r");
echo fread($file, filesize("example.txt"));
fclose($file);

Database Connectivity:

11. Database Connection:

  • Using mysqli or PDO for database interactions.
$conn = new mysqli("localhost", "username", "password", "database");

Security:

12. Security:

  • Protect against SQL injection and XSS attacks.
  • Use prepared statements for database queries.
$stmt = $conn->prepare("INSERT INTO table (column) VALUES (?)");
$stmt->bind_param("s", $value);
$stmt->execute();

Conclusion:

These notes cover the basics of PHP, but there's much more to explore. PHP is versatile and widely used for web development, from simple scripts to complex applications.

For in-depth learning, refer to the official PHP Documentation and explore real-world projects. Happy coding!

License

This repository is licensed under the MIT License, allowing for widespread use and collaboration.

Contact

For any questions, feedback, or collaboration inquiries, feel free to reach out:

Feel free to customize the content as needed to better suit your repository and audience. Let me know if you need further assistance!

php-fundamentals's People

Contributors

pradipchaudhary avatar

Stargazers

 avatar  avatar

php-fundamentals's Issues

Feature Showcase: [Concise and descriptive title of the issue]

Title:
[Concise and descriptive title of the issue]

Description:
[Provide a detailed description of the issue, including any relevant information such as steps to reproduce, expected behavior, and actual behavior.]

Environment:
[Include details about your development environment, such as PHP version, operating system, or any other relevant information.]

Steps to Reproduce:

[Step 1]
[Step 2]
...
Expected Behavior:
[Describe what you expected to happen.]

Actual Behavior:
[Describe what actually happened.]

Screenshots/Additional Information:
[Include any screenshots or additional information that might help in understanding or resolving the issue.]

Labels:
[Assign relevant labels to categorize the issue, such as bug, enhancement, documentation, etc.]

Priority:
[Set the priority level, if applicable, e.g., low, medium, high.]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.