Back to Dashboard

PHP

PHP is Server side Scripting Language,initially it was called "Personal Home Page" now a days it is called "Hypertext Preprocessor".It was developed by Rasmus Lerdorf
Cureent version of php is 7.4.4
In Php Variables are defined by "$"
There are Following string functions in php:
  1. strlen() - Return the Length of a String
  2. str_word_count() - Count Words in a String
  3. strrev() - Reverse a String
  4. strpos() - Search For a Text Within a String
  5. str_replace() - Replace Text Within a String
  6. ltrim()-Removes whitespace or other predefined characters from the left side of a string
  7. rtrim() - Removes whitespace or other predefined characters from the right side of a string
  8. strtolower()-Converts a string to lowercase letters
  9. strtoupper()-Converts a string to Uppercase letters
  10. ucfirst()- Converts the first character of a string to uppercase
Constants are name or identifier that can not be changed during execution of the script. There are two ways of defining constants in Php:
  1. Using define() function
  2. Using const() function
There are following ways of commenting in php
  • //text goes here
  • # text goes here
  • /**/ text goes here
Methods of submitting form in php are
  1. GET
  2. POST
Loops in PHP:
  1. For loop
  2. While Loop
  3. do While Loop
  4. Foreach Loop
Header function is used to redirect to a location in php
ex: header("location:index.php");
there are three types of array in php:
  1. Index array
  2. Associative array
  3. Multidimensional array
POST method is secure in php because it does not our form value in url whereas GET method shows our data in URL.GET method url seems like this
index.php?fieldname1=value&fieldname2=value2
For creating session in php We use session_start()
No. PHP is a weakly typed or loosely typed language.
This means PHP does not require to declare data types of the variable when you declare any variable like the other standard programming languages C# or Java. When you store any string value in a variable, then the data type is the string and if you store a numeric value in that same variable then the data type is an Integer.
Example:
$Myvar = "Hello World"; //String
$Myvar = 10; //Integer
Content