高分有关问题一枚
高分问题一枚
数据库表中一个来电字段caller
caller有普通的手机号,也有带0的手机号,还有010-1234567这样的座机号码等等
请问如何去掉那些前面带0的手机号?
求高效实现
------解决方案--------------------
手机号和座机号有如下区别
长度
号码内是否存在"-"
区别出手机号 过滤首位 为0的手机号码
是这样吧?正则咯...
------解决方案--------------------
select ... where left(caller,1)!='0';
------解决方案--------------------
座机号加区号是11位把。手机号还有前导0的话就大于11位了。根据这个规则来替换。
------解决方案--------------------
- SQL code
SELECT * FROM `tbl` WHERE `calller` REGEXP '^01[3458]+';<br><font color="#e78608">------解决方案--------------------</font><br>手机号码前段没几个,可以根据这个来判断<br><br>
- PHP code
$tel = $val){ if($val[0] == '0' && in_array("$val[1]$val[2]", $tel_arr)) $tel[$key][0] = '';}print_r($tel);<br><font color="#e78608">------解决方案--------------------</font><br>手机号都是 1 打头<br>只要排除掉 010 北京区号就可以了<br><br>$caller = preg_replace('/^0(1[^0])/', '$1', $caller);<br><font color="#e78608">------解决方案--------------------</font><br>
------解决方案--------------------
直接 mysql 操作
- SQL code
update tbl_name set caller=substr(caller,2) where caller regexp '^01[^0]'<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



According to news from this site on September 3, Korean media TheElec reported yesterday that Samsung is testing Tokyo Electron (TEL)'s AcreviaGCB gas cluster beam (Note from this site: GasClusterBeam) system. TEL's AcreviaGCB system was released on July 8 this year. It can locally and accurately shape EUV lithography patterns through gas cluster beams, thereby repairing pattern defects and reducing pattern roughness. Industry insiders believe that TEL's Acrevia system can play a similar role to Applied Materials' CenturaSculpta system, that is, directly shape EUV exposure patterns, reduce costly EUV multiple exposures, thereby shortening the photolithography process and improving the overall

Practical Guide to Where Method in Laravel Collections During the development of the Laravel framework, collections are a very useful data structure that provide rich methods to manipulate data. Among them, the Where method is a commonly used filtering method that can filter elements in a collection based on specified conditions. This article will introduce the use of the Where method in Laravel collections and demonstrate its usage through specific code examples. 1. Basic usage of Where method

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

How to use the Where method in Laravel collection Laravel is a popular PHP framework that provides a wealth of functions and tools to facilitate developers to quickly build applications. Among them, Collection is a very practical and powerful data structure in Laravel. Developers can use collections to perform various operations on data, such as filtering, mapping, sorting, etc. In collections, the Where method is a commonly used method for filtering the collection based on specified conditions.

From beginner to proficient: Master the skills of using is and where selectors Introduction: In the process of data processing and analysis, the selector is a very important tool. Through selectors, we can extract the required data from the data set according to specific conditions. This article will introduce the usage skills of is and where selectors to help readers quickly master the powerful functions of these two selectors. 1. Use of the is selector The is selector is a basic selector that allows us to select the data set based on given conditions.

Preface When we write SQL statements, we cannot avoid using connection keywords, such as inner connections and outer connections. There are many types. I will post here a picture I found elsewhere: I think this picture is very detailed. It shows the common link types in SQL statements. Take leftjoin in this article as an example. It is available online. As defined: the LEFTJOIN keyword will return all rows from the left table, even if there are no matching rows in the right table. In fact, literally speaking, leftjoin is relatively easy to understand, but there are still some problems during use. For example, if the condition is after on and after where, their results are completely different. Let's go from shallow to deep

Laravel is a popular PHP development framework that provides rich and convenient functions. Collection is one of the very important data structures in Laravel. The collection class provides many powerful methods, one of which is the where method. This article will use specific code examples to analyze the usage of the where method in Laravel collections. 1. Create a collection First, we need to create a collection that contains some data. Can

Laravel is a popular PHP framework, and its Collections class provides powerful data processing functions. Among them, the Where method is one of the commonly used methods in collection classes, used to filter data that meets conditions. This article will introduce the Where method of Laravel collection in detail, including usage methods, parameter meanings, and specific code examples. 1. Overview of the Where method The Where method is used to filter elements in the collection that meet specified conditions and return a
