Category : oop

I am injecting a class with a DirectoryIterator, and am confused why its properties in the constructor are different than when accessed in a later method. I expect it must be mutable but really don’t understand the implications. Please explain what is happening. $inputFiles = []; foreach (new DirectoryIterator($folder) as $fileInfo) { if(!$fileInfo->isDot()) { $inputFiles[] ..

Read more

<?php class validation{ public $email; public $password; function __contruct(string $email,string $password){ $this->email=$email; $this->password=$password; } function validateUser():bool{ if( $GLOBALS[’email’]=="[email protected]"){ if( $GLOBALS[‘password’]=="123"){ return true; }else{ return false; } }else{ return false; } } } $user_validate= new validation($_POST[’email’],$_POST[‘password’]); $result=$user_validate->validateUser(); if($result==true){ echo "You are logged in"."<h1 style=’color:green;’>".$_POST[’email’]."</h1>"; }else{ echo "Incorrect <span style=’color:red;’>Email</span> or <span style=’color:red;’>Password</span>!<br> Please try again "."<a ..

Read more