Home >Backend Development >PHP Tutorial > 计作数值是否是包含AA AABB AAA AAAA AAABBB AAAABBBB AAABBBCCC

计作数值是否是包含AA AABB AAA AAAA AAABBB AAAABBBB AAABBBCCC

WBOY
WBOYOriginal
2016-06-13 12:54:461483browse

计算数值是否是包含AA AABB AAA AAAA AAABBB AAAABBBB AAABBBCCC

<?php <br />
//$a是一个10位的随机值式 <br />
$int_a=2334357984; <br />
echo 'AA'; <br />
echo '33'; //还想输出33 <br />
<br />
$int_a=2332257984; <br />
echo 'AABB'; <br />
echo '3322'; //还想输出3322 <br />
<br />
$int_a=2333357984; <br />
echo 'AAAA'; <br />
echo '3333'; //还想输出3333 <br />
<br />
$int_a=2333555984; <br />
echo 'AAABBB'; <br />
echo '333555'; //还想输出333555 <br />
<br />
$int_a=2333888666; <br />
echo 'AAABBBCCC'; <br />
echo '333888666'; //还想输出333888666 <br />
....................

php
------解决方案--------------------
$int_a=2332257984; <br />
preg_match('/(.)\\1(.)\\2/', $int_a, $r);<br />
echo $r[0];<br />
3322
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn