Define a function after its call

#1

Hello !
I have the following code:

<?php

    $getSEO = new getSeo;

    $data['title'] = $getSEO->getTitle();

    $getSEO->setTitle(''.$values2['title'].'');

?>

Can I set a getTitle () value after its call?
The work of setTitle () is to set the value of $ title and then pass it on to getTitle ()

#2

Why are you using quotes?

#3

Tell us what the real problem is you are trying to solve instead of asking about your attempted solution to the real problem.

#4

Hello !
I apologize for the misrepresentation of the problem, I myself have recently been dealing with the so-called OOP and I still do not understand why and why. But anyway, I’ll be fine! Now I’m trying to get the getTitle () string I’m typing with the setTitle () function I wrote so that when a value is sent to setTitle () it is passed to getTitile () and then I print it, where I need it. But … it works correctly when I set a setTitle () value before calling getTitile (). Can this sequence be reversed?

What do I mean?
I want to set a different title on each page, but this title is set by the body of the page, respectively, once the head.php where the getTitile ()

#5

No. That’s like calling someone by their name before asking what it is. You are setting the value, then you are using it. But depending on your situation, do you need to set that value, or do you just need to print it once?

#6

Yes, I have to ask her. I think I’ve found a solution I have shifted the call, as it should be in sequence, and now just by calling a page, the data is filled in by the variables.