Difference Single Quotes('') and Double Quotes("")
According to Output string there are two of types of string in php
1. processed string : Denoted ""
2. Unprocessed String (raw string): ''
Invalid Case:
"" inside "" invalid X Manage using escape Operator
'' inside '' invalid X using escape operator
"" inside '' valid
'' inside "" valid
processed string : "" each character is first processed then sent to
output stream.
1. varibles inside "" are processed then printed
2. escape character sequence inside (\n,\t,\r,.....) are processed
raw string : '' No processing each character printed as it is
directly flush to output stream.
1. varible itself is printed
2. escape character sequence inside (\n,\t,\r,.....) are not printed
as it is.
Common behaviour:
if you try to use <html> tags inside "" or '' it is treated as string
for printing html you can use any '' or "" qoutes no issue at all.
Running PHP webserver On Command Line
---------------------------------------
php version 5.5.6+ php donot require any webserver it has its own inbuilt
cli server
Command : php -S localhost:<port-no>
eg : php -S localhost:8888
Request and Request Forwarding in PHP CLI server
1. php 5.5.6+ provides inbuilt web server support
it donot require any other servers like apache for testing purpose
But in order to deploy your project built on php will require
certain resource like smtp, mail services,database driver such type
of resource can only possible with multi purpose server.
so Apache is a Good Choice for All Cpanel in web-hosting
ngix Server is also good choice for All Cpanel in Web-hosting
2. php cli server uses your operating System Environment Access and Uses it
since every command is executed from command line priority is highesht
For Example :
Which File will be processed first placed at c:/xampp/htdocs
at port :8000 or c:/users/path/to/file at port :8000
Answer :
c:/xampp/htdocs
at port :8000 Request --->Apache is a third party service
it is using 8000 port but temperory assigned
but
c:/users/path/to/file at port :8000 use php cli server has highest priority
due to command line hence port is reassigned
3. if you try to access resource at a port which is already reserved for system
specific services then such port cannot be assigned.
before you assign any port to php cli server use netstat -a to get list
of all TCP/IP Port List
4. Command to run php cli server : php -S localhost:portno
5. each request is processed by a foreign Address ::1:[Any port No]
6. as soon as port[cli server start] is Assigned following things takes place
1. port is assigned
2. foreign Address is reserved
3. Document Root is Created
4. Request is sent to index.php file if not then to index.html if not
to 404 Error
But Every request can be re-routed using any router.php file
php -S localhost:8000 index.php (code Ignitor 3,4.0,yii)
phalcon framework re-routes request in router.php
p1.php
php p1.php
php [-S localhost:8000] p1.php
|
|
Command Replace
How to Run Server to any target location or SAPI(specific Application Programming Interface)
Create Folder name test
test
|--->public_html
| |--------->index.php
| |---css/js/images
|
|-->server.php
<?php
#server.php
$uri = $_SERVER['REQUEST_URI'];
echo $uri;
#Index.php
<?php
echo "This is Public file Welcome to My Framework";
include '../server.php';
This project can be run by two ways
1. php -S localhost:8000 server.php
2. using target root
php -S localhost:8000 -t <root_name>
Working with Webform in PHP
(whatwg) : Whatwg : web hypertext Application Technology working grouo
is responsible for Concept Called User Interactivity
by introducing the concept of web form
1. HTML Forms
2. Web Forms 2.0
3. Advanced Forms 3.0 [html 5]
First Web Form was launched on 2004
0 Comments