Jump to content

ereg() deprecated error


MidOhioIT

Recommended Posts

does anyone know why I am getting the error:

Deprecated: Function ereg() is deprecated on line 75   ?

 

here is line 75 (line 3, the seond if statement):

      if($form_cc_type == 'visa')
   {
    if(!ereg('^4[0-9]{12}([0-9]{3})?$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }

 

I am assuming I would get a simular error on all the ereg lines...

 

if($form_cc_type == 'visa')
   {
    if(!ereg('^4[0-9]{12}([0-9]{3})?$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }

      elseif($form_cc_type == 'mastercard')
   {
    if(!ereg('^5[1-5][0-9]{14}$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }
  elseif($form_cc_type == 'americanexpress')
   {
    if(!ereg('^3[47][0-9]{13}$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }
  elseif($form_cc_type == 'diners')
   {
    if(!ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }	   
  elseif($form_cc_type == 'discover')
   {
    if(!ereg('^6011[0-9]{12}$', $form_cc_number))
	 {
	   $form_error = "Invalid number";
	 }
   }	

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.