Author Jani Hartikainen published a blog post, which compares the two to illustrate the five reasons PHP is better than node. js. Look at it together.
1. Easy to host
Most web hosting server providers can host PHP, and for node, you need to find
The code looks like this:
Copy CodeThe code is as follows:
Abstract class of the person being observed
Class observed implements splsubject{
protected $_name;
protected $_observers;
Instantiate, generate an observer objectPublic Function
The following are the core files:
index.php file
Copy CodeThe code is as follows:
Header (' content-type:text/html charset:utf-8 ');
Date_default_timezone_set (' PRC ');
$rootDir = ' listfile '; Site root, load all files of this program
Site
First, MongoDB Introduction
MongoDB (named from "Humongous") is a scalable, high-performance, open-source, schema-free, document-oriented database that combines the benefits of a document database, key-value pair storage, and relational database.
The function to use:
Str_split: Splits a string into an array. A similar function explode () function splits a string into arrays. Array_count_values: Used to count the occurrences of all values in the array.
Arsort: Reverses the array and maintains
Talk about the difference between mysql_connect and Mysql_pconnect, the two functions of the use of the same, the internet has said should be used Pconnect, pconnect is a good thing, also see pconnect as a scourge, resolutely not to use pconnect,
Reference types (Reference) are used in many computer languages and are present as a very powerful and useful feature. It has a similar pointer (Pointer) implementation, but it is different from the performance of the pointer. For example, C + +
is_null, Empty, isset, unset Let's take a look at the descriptions of these 4 functions first.
Isset to determine if a variable already exists (config)unset Delete (release) the variableEmpty to determine if the variable is nullIs_null to
Copy CodeThe code is as follows:
Http://www.jb51.net/article/23093.htm
function Set_cache ($name, $value) {
Set relative or absolute directories, don't add "/" at the end
$cache _dir = "./cache";
Setting extension
$cache _extension = ".
PHP two-dimensional array sorting function, the default natural sort, that is sort. Here you can specify a number of methods to sort by a value in a two-dimensional array, depending on the program note below.
Copy CodeThe code is as follows:
/**
* @
Copy CodeThe code is as follows:
Initialize Gridfs
$conn = new Mongo (); Connect to MongoDB
$db = $conn->photos; Select Database
$grid = $db->getgridfs (); Get Gridfs Object
Gridfs There are three ways to store filesThe First Direct storage
First, PHPAPC installationDownload and unzip the installation package:
Copy CodeThe code is as follows:
Wget-c http://pecl.php.net/get/APC-3.1.13.tgz
TAR-ZVXF apc-3.1.13.tgz
cdAPC-3.1.13
Compile and install:
Copy CodeThe code is as follows:
Wget-c
Just touched the question, I did not consider the iterator model, tried a few general ideas, after the failure .... Just go to look at the source of the foreach implementation, expect to find out when the foreach processing object when there is any
PHP files are usually stored in text format on the server side, it is easy for others to read the source code, in order to protect the source code, you can use the source code to encrypt the way. Two parts are required to implement this
The sorting of several array functions mentioned below has some commonality:The 1 array is used as the parameter of the sort function, and after sorting, the array itself is changed, and the return value of the function is type bool.
2 A single-a
Array_merge is a key that discards the original number, retains a key in the form of a string, and then forms a new array, regardless of whether the key name is the same or not, unless the key name and value are the same and must be a key in the
Fire Station College (bkjia.com) PHP tutorialPHP gets Remote Web page content in several ways, such as using its own file_get_contents, fopen and other functions.
Echo file_get_contents ("http://www.bkjia.com/abc.php");?>
One, the chat room module implementation1, Chat Room home window settings
Copy CodeThe code is as follows:
2, file Operation functionThis chat room module uses text to save the user list and speech
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service