PHP read local php File source code output display

If I have two files a.php,b.php. The statements in the a.php file are: The code is as follows Copy Code echo "I am a.php";?> Now, I need to display the source code in the file a.php in the b.php file, which is

PHP multi-dimensional array sorting implementation code

Sort by single arraySort functions in ascending orderBool sort (array & $ array [, int $ sort_flags = SORT_REGULAR]) The code is as follows:Copy code $ Fruits = array ("lemon", "orange", "banana", "apple ");Sort ($ fruits );Var_dump ($ fruits );?

Introduction to PHP file uploading through FTP

The ftp_get () function downloads an object from the FTP server.If the call succeeds, true is returned. If the call fails, false is returned.SyntaxFtp_get (ftp_connection, local, remote, mode, resume)The ftp_connect () function creates a new FTP

Php floating point rounding function

The round () function rounds a floating point number.SyntaxFloat round (float val [, int precision])Returns the result of rounding val by the specified precision (number of digits after decimal point. Precision can also be negative or zero (default )

Php date and time () functions

Here is a simple method: The code is as follows:Copy code Result: 16:21:38Time () function: displays the current system time.The time () function returns the Unix timestamp of the current time.SyntaxTime (void) parameter descriptionVoid is

Php uses json_decode to forcibly convert json data to an array

The code is as follows:Copy code $ A ['D'] [] = 1;$ A ['D'] [] = 2;Echo $ str = json_encode (array ($ ));Var_dump (json_decode ($ str )); Conversion code The code is as follows:Copy code Array (1 ){[0] =>Object (stdClass) #1 (1 ){["D"]

Php string truncation function

The code is as follows:Copy code // Construct a string$ Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";Echo "original string: ". $ str. " ";// Intercept in various ways$ Str1 = substr ($ str, 5 );Echo "starts from 5th characters to the end:". $ str1. " ";$

Common php array functions

In the php Tutorial, arrays are powerful data types. They can do a lot of things and store different data types in an array. Below we list the common operations of arrays, sort and sort the array by key name./* Common functions of arrays ** Array

Php function definition and Function & reference usage

/* Function definition:* 1. The function is named* 2. Independent code segments* 3. The Function executes a specific task.* 4. You can return a value to the program that calls it. ** Advantages of functions:* 1. Improve program reusability* 2.

Php method_exists check whether the class contains functions

Php Tutorial method_exists check whether the class contains functionsThe syntax of the method_exists () function is as follows: bool method_exists (object, string method_name)The method_exists () function is used to check whether the methods of the

Php intercepts a string of a certain length (this function is valid for GB2312)

Function ssubstr ($ string, $ length, $ dot = '...'){Global $ charset;If (strlen ($ string) Return $ string;  }$ String = str_replace (array ('& amp;', '& quot;', '& lt;', '& gt;'), array ('&', '"', ''), $ string );$ Strcut = '';If (strtolower ($

The difference between two time points in php mktime calculation

Mktime = mktime ($ hours, minute, seconds, month, day, years)$ Start_time = mktime (,); // start time$ End_time = mktime (,); // end time$ Times = $ end_time-$ start_time ;//How many seconds is the difference between start and end? 6$ Now_time = $

Php fsockopen post data sending instance

Function do_call ($ host, $ port, $ request) // defines the function{$ Fp = fsockopen ($ host, $ port, $ errno, $ errstr );$ Query = "post/default/php Tutorial/server. php http/1.0nuser _ agent: this is a dummy clientnhost :".$ Host. "ncontent-type:

Uncommon ip address conversion functions and instance applications in php

$ Ip = "127.0.0.1"; // define an ip address$ Long = ip2long ($ ip); // Convert the ip address to an integer.If ($ long =-1 | $ long = false) // if the execution is incorrect{Echo 'invalid ip, please try again '; // output error message}Else{Echo $

Php log operation function closelog () define_syslog_variables ()

*/$ Result = closelog (); // disable system logs.If ($ result){Echo "system log disabled"; // output result}//Define_syslog_variables (); // clear all system logsEcho "system log cleared"; // output result//Define_syslog_variables (); // clear all

Function for obtaining the IP address of the host name protocol in php

*/$ Hostname = gethostbyaddr ($ _ server ['remote _ addr ']); // Obtain the host nameEcho $ hostname; // output result//$ Hosts = gethostbynamel ('localhost'); // obtain the IP address listPrint_r ($ hosts); // output array//$ Protocol = 'tcp '; //

Php stream_context_create function

Function prototype: resource stream_context_create ([array $ options [, array $ params])View instances// Define the options array$ Opts = array('Http' => array  ('Method' => "get ",'Header' => "accept-language: enrn". "cookie: foo = barrn"  ));//

Regular functions are often used in php development.

$ Temp [0] = "abc ";$ Temp [1] = 123;$ Temp [2] = "us .";$ Temp [3] = 5;$ Temp [4] = 58;$ Temp [5] = "cs ";// The code above defines an array with both numbers and stringsEcho "the contents of the array temp are :";Echo " ";// Output array content

Php file operations (delete, modify time, rename, get file owner)

$ File = "test.txt"; // definition fileEcho fileowner ($ file); // get the file owner/*The fileowner () function returns the object owner.If yes, all user IDs of the file are returned. If it fails, false is returned. The user id is returned in

Total Pages: 12780 1 .... 9378 9379 9380 9381 9382 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.