how to filter 12 digits integers in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kuttus
Forum Newbie
Posts: 15
Joined: Sun Jun 21, 2009 3:48 am

how to filter 12 digits integers in php

Post by kuttus »

how to filter the 12 digits integers in php can u help me buy giving the solution
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: how to filter 12 digits integers in php

Post by Eric! »

Code: Select all

<?php
if (preg_match("[0-9]{12}", $data, $matches)) {
  echo "Match was found <br />";
  echo $matches[0];
}
?>
Last edited by Benjamin on Wed Jun 24, 2009 10:40 am, edited 1 time in total.
Reason: Added [code=php] tags.
Post Reply