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? =)

Recommended Answers

All 3 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.