Php + mysql obtains the video table information. How to match and intercept name
Source: Internet
Author: User
Php + mysql obtains the video table information. How to match the video information captured from the namephp + mysql database video table video_list, where the field video_name is as follows: & nbsp; data 1 Lecture Hall 20111220 & nbsp; data 2 lecture 201 php + mysql obtains video table information. How to match the truncation name
Php + mysql database video Table video information video_list
The video_name field is as follows:
Data 1 hundred forums 20111220
Data 2 hundred forums 20111214 Wang Liqun reading historical records-Qin Shihuang (30th)
For data 1, directly obtain video_name and output
If it is a character output after data 2 truncation time
There is a space character between the left and right sides of the 8-digit date number.
How can I judge and intercept the types in the 2 in a loop? What should I do if I use regular expressions?
------ Solution --------------------
$ T = preg_split ('/\ s + \ d + \ s +/', $ roe ['video _ name'], PREG_SPLIT_NO_EMPTY );
Echo end ($ t );
------ Solution --------------------
A parameter is missing.
$ T = preg_split ('/\ s + \ d + \ s +/', $ roe ['video _ name'],-1, PREG_SPLIT_NO_EMPTY );
------ Solution --------------------
$ Roe ['video _ name'] = 'from the lecture hall 20111214 Wang Liqun reads "historical records"-Qin Shihuang (thirty) Life and Death ';
$ Chars = preg_split ('/[0-9]/', $ roe ['video _ name'],-1, PREG_SPLIT_NO_EMPTY );
$ Rs = (count ($ chars)> 1 )? $ Chars [1]: $ roe ['video _ name'];
Echo $ rs;
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