Hongmu Notes
Home Language Notes PHP

PHP

PHP (Hypertext Preprocessor) is a server-side scripting language particularly suited for web development and can be embedded within HTML. Its syntax is derived from the C language, incorporating features from languages such as Java and Perl to develop its own distinctive grammar; it has also been continuously refined and enhanced based on the strengths of these languages—for example, leveraging Java's object-oriented programming capabilities.

PHP preg

PHP preg Language Notes PHP PHP collection

<?php $userinfo = "Name: <b>PHP</b> <br> Title: <b>Programming Language</b>"; preg_match_all ("/<b&…
👁 169
php mt

php mt Language Notes PHP

The mt_rand () function uses the Mersenetwister algorithm to generate random integers. Tip: This function is a better choice to generate random values, and the speed of returning results is four times that of rand () function. Tip: If you want a random integer between 10 and 100 (inclusive), please use mt_rand (10,100). & lt…
👁 172
How to remove escape characters in php

How to remove escape characters in php Language Notes PHP

Php's method of removing escape characters: string stripslashes (string $str) returns a string (' Convert to ' Wait). The backslash (\) is converted into a single backslash (). Stripslashes () is non-recursive. If you want to use this function in multidimensional arrays, you need to use recursive functions.
👁 144
PHP special character escaping and restoration

PHP special character escaping and restoration Language Notes PHP PHP collection PHP and mysql

Escape character is a special character constant. Escape characters are backslashed " & quot; At the beginning, followed by one or more characters. The escaped character has a specific meaning, which is different from the original meaning of the character, so it is called "escaped" character. The use of escape characters 1: turn ordinary characters into special purposes, such as back key and enter key. 2. Used to convert a character with special meaning back to its original meaning. 3. Before data is written into the database, escape characters (function …
👁 180
Methods of division and rounding in php (round, ceil, floor)

Methods of division and rounding in php (round, ceil, floor) Language Notes PHP

When the result of division needs to be rounded in PHP, the following methods are needed: 1. round: round () function rounds floating-point numbers. Syntax: round(x, prec) parameter description x is optional. Specifies the number to round. Prec is optional. Specify the number of digits after the decimal point. Description: Returns the number of x based on the specified precision prec (decimal decimal number …
👁 212
Remove Chinese from php string

Remove Chinese from php string Language Notes PHP

& lt; ? php $a = & quot; & lt; a& gt; The crab society afeowahgieawhjozf waits for the snake fawgwea to maintain stability aghoiawghowi &amp lt; /a& gt; & quot; ; $result = preg_replace(' /([\x80-\xff]*)/i' ,' ' ,$a); var_du…
👁 142
PHP gets all files in a folder and returns scandir() function as an array

PHP gets all files in a folder and returns scandir() function as an array Language Notes PHP

List the files and directories in the images directory:&; lt; ? php $dir = & quot; /images/& quot; ; $a = scandir($dir); $b = scandir($dir,1); print_r($a); print_r($b); ? & gt; Results: array ([0] =&; gt…
👁 126
Identification and understanding of php paths

Identification and understanding of php paths Language Notes PHP

The following are several special symbols used to establish the path and their meanings. "./":represents the current directory. "../":stands for the upper level directory. Start with "/":stands for root directory.
👁 119
How to set response headers in php

How to set response headers in php Language Notes PHP

Setting response headers in PHP: 1. Setting the response header for file types: `<?php header('Content-Type: text/css; charset=GBK'); // For CSS files, using GBK encoding; header('Content-Type: text/html; charset=UTF-8'); // For HTML files, using UTF-8 encoding...`
👁 131
PHP regular replacement preg

PHP regular replacement preg Language Notes PHP PHP collection

& lt; ? php $str=& quot; as2223adfsf0s4df0sdfsdf& quot; ; echo preg_replace(& quot; /0/& quot; ,& quot; & quot; ,$str); //Remove the 0 character, which is equivalent to the function of replace, preg _ replace (&; quot; /…
👁 167
1 19 20 21 22