I'm new to programming, but I have a problem that I can not solve.
How do I do in PHP to save an instance of a class? Because currently I instantiate a class and after the script stops executing, all I assign is lost. And I have to instantiate again.
Class example:
<?php
class Usuario{
private $nome;
private $idade;
// ... outros atributos
public function CalcularSalario(){
//Realizar calculo complexo com base nas informações salvar na classe
}
}
So every time I need to get the user data in the bank and perform a "complex" wage calculation. But if I already had somewhere, I would just recover the class and if there is any change in the user, I would only setaria the values and had to calculate again.