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:
strlen() - Return the Length of a String
str_word_count() - Count Words in a String
strrev() - Reverse a String
strpos() - Search For a Text Within a String
str_replace() - Replace Text Within a String
ltrim()-Removes whitespace or other predefined characters from the left side of a string
rtrim() - Removes whitespace or other predefined characters from the right side of a string
strtolower()-Converts a string to lowercase letters
strtoupper()-Converts a string to Uppercase letters
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:
Using define() function
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
GET
POST
Loops in PHP:
For loop
While Loop
do While Loop
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:
Index array
Associative array
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
There are follwoing array functions in php:
array() - Creats an array
array_pop() - Deletes the last element of an array
array_push() - Inserts an element of an array after the last element
array_reverse() - Getting an array in reverse order
count() - Counts the number of elemnts in an array
sort() - This function sorts an indexed array in ascending order