Giter VIP home page Giter VIP logo

php's Introduction

PHP

Php Constants are name or identifier which cannot be modified Throughout the execution of a program

Php constants can be defined by 2 ways:

Difference Between Constants and Variable

PHP Costants PHP Variables
No Need To use $ $ sign is used
DataType Can't be Changed DataType can be Changed
Can't be Redefined Can be Redefined

PHP comments

A comment in PHP code is a line that is not executed as a part of a program

It's purpose is to be Read By someone who is looking at the code There Are two type of Comments in PHP

  • Single-Line
  • MultiLine
<?php
    // This is Single-line comment
    # Is is also a Single-line comment
?>
<?php 
/* This is a Multi-line Comment
that can comment multiple 
Lines */ 
?>

Just like other Programmign language , PHP also supports various types of Operations like Arithmetic Operation, Logical Operations ,Increment/Decrement Operation ,etc

Array is a Compound Data Type That hold multiple values of similar type in a single Variable

Type of Array In PHP

Advantage of PHP Array

  • Less Code: We Don't need to define Multiple variables.
  • Easy to Traverse: With a single loop we cal traverse all the element of an array
  • Sorting: We can sort the array

Array Functions

In Any Programming Languages , Control structures are specific commands which are used to control the Logical flow of the Program during its execution.

There are two types of Control Structure in Php

In simple way ,A Regular Expression Is a way to do pattern matching . A regular Expression is a string that represents a pattern.

It is Commonly Known as "Regex" or "RegExp"

There are mainly three uses for regular Expression

Some predefined Variables in PHP are "SuperGlobals",which means that they are always accessible , regardless of scope and you can access them from any function , class or file without having to do anything special.

ex - $GLOBALS , $_GET , $_POST

A function is a piece of code in a larger program . The function performs a specific task

Advantages

  • Reducing duplication of code
  • Decomposing complex problems into simpler pieces
  • Imporving clarity of the code
  • Reuse of code

Types of Functions

Variable Scope

The scope of a variable is defined as its range in the program under which it can be accessed. In other words, "The scope of a variable is the portion of the program within which it is defined and can be accessed."

Types of variable scope

PHP makes use of mail() To send an email.

mail(to,subject,message,header,parameters);

HTTP is a stateless protocol which means every user request is processed before it . Hence there is no way to store or send any user specific details using HTTP protocol.

PHP allows us to save certain states of the application either on the server itself, or in the user's browser . In form of Session and Cookies

File Handling is an important part of web application. We often need to open and process a file for different tasks. PHP has several functions for creating , reading , [uploading] , and editing files Ex - fopen() , fwrite() , fclose()

We can include the content of a PHP file into another PHP file before the server executes it . There are two PHP function which can be used to include one PHP file into another File.

Procedural programming is about writing procedures or functions that perform operations on the data , while object-oriented programming is about creating objects that contain both data and functions.

Object oriented programming had several advantages over procedural programming

  • It is Faster
  • It provides a Clear Structure for the Programs
  • It helps to Keep the PHP code "DRY: Don't Repeat Yourself", and makes the code easier to maintain , modify and debug
  • It ensures that the created code is fully reusable with less code and shorter time

php's People

Contributors

kanishkrawatt avatar

Stargazers

 avatar

Watchers

 avatar

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.