PHP core technology

1. Write a PHP function that can create multi-level directories

2. Write a piece of PHP code to ensure that multiple processes write files successfully

3. Write a PHP function to extract the file extension from a standard URL as efficiently as possible, for example: http://www.sina.com.cn/abc/de/fg.php?id=1 needs to be taken out php or .php

method one:

Method Two:

 4. Write a PHP function that can traverse all files and subfolders in a folder

5. Briefly describe the realization principle of unlimited classification in the forum

create table category(

  cat_id smallint unsigned not null auto_increment primary key comment '类别ID',

  cat_name varchar(30) not null default'' comment'Category name',

  parent_id smallint unsigned not null default 0 comment '类别父ID'

)engine=MyISAM charset=utf8;

Write a function, recursive traversal to achieve unlimited classification

6. Write a PHP function to calculate the relative path of two files, such as $a ='/a/b/c/d/e.php'; $b ='/a/b/12/34/c.php '; calculate the relative path of $b relative to $a

7. Write a PHP function to remove HTML tags

Method 1: Use the PHP built-in function strip_tags() to remove HTML tags

Method two: custom function

8. Write a function to verify that the format of the email is correct (using regular)

preg_match('/^[\w\-\.]+@[\w\-]+(\.\w+)+$/',$email);

9. Determine whether a character is a legal date format in PHP

10. Write a PHP function to get the most day of the previous month

 11. Please use PHP to design a function to sort students' English test scores from high to low, input the student numbers and test scores of all students, and return the ranked test scores and corresponding student numbers. The full score of the test is 100, and the score may have decimals. Due to test scoring requirements, the decimal places will only be 0 or 0.5

Guess you like

Origin blog.csdn.net/zy17822307856/article/details/113037929