0

Hello I need some advice (I'm not expecting code - Just want to know if it's possible / references)

Basically, I want to create a class that I can check if the email has been submitted AND also, if it's formatted right (e.g. does it contain a @ but also go into a lot more depth) so it'd look a bit like:

<?php

   include ('validationClass.php');

   $validation = new Validation();

   if($validation->validate($_POST['email']))->formatted())
   {
      echo 'Yes';
   }
?>

So like:

$this->validate->formatted()

Any suggestions? =)

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by pritaeas
0

Is there a particular reason you want to call two functions like that ? IMO readability will suffer greatly. Let alone designing how validate and formatted should interact with each other (like handling validation errors).

Technically, it should be possible, if the validate function returns an object with a formatted method.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.