What is PHP?
It is hypertext preprocesser and open source.It is an server side interpration language which used to develop web pages.
What is session in PHP?
As HTTP is state protocol. To maintain the state on server and share across multiple pages PHP sessions are used. It is simple way to store data for individual users/client against unique session ID. Session IDs are sent to the browser via session cookies and ID is used to retrieve existing session data. Usually it will be stored as text file in tmp folder which cannpt be accessessed by others.
<?php
session_start(); //starting session
$_SESSION["userid"]=10; //storing the session
if($_SESSION["userid"] == 10) //retrieving the session value
Note: Default session time in PHP is 1440 seconds - 24m.
PHP data types?
PHP supports 9 primitive types
- integer
- boolean
- float
- string
- array
- object
- callable
- resource
- null
What is purpose of @ in php?
@ is used to suppress error messages. Add @before any statement in php then if any runtime error will occur on that line, then the error handled by PHP
How constant defined in PHP?
define("CNAME",value);
How to get no of arguments passed to a PHP function?
func_get_args() - is used to get number of arguments passed in a PHP function. Example
function disp(){
return func_get_args();
}
echo disp(10,20,30,40,50);//output 5
Comments
we
Submitted by admin on Sun, 07/22/2018 - 04:08