1
Good afternoon,
I want to print the value of the array entered in the getTitleIdLocation function, which I am doing wrong?
Thanks in advance.
<?php
class Imovel {
private $title;
private $id;
private $location;
function __construct($title, $id, $location){
$this->title = $title;
$this->id = $id;
$this->location = $location;
}
function getTitleIdLocation(){
return array($title, $id, $location);
}
}
$casa = new Imovel ("Apartamento", "3", "Porto");
echo $casa -> getTitleIdLocation();
?>
Depends on what you will do with the result? needs to print in some way in specific?
– novic
Possible duplicate of View associative array elements with foreach
– Woss
Other View array value in php / Array to string Conversion in
– Woss
Possible duplicate of I can’t access the function
– novic
This question should be marked as a duplicate of the question he himself has already asked and has even been answered?
– novic
I closed as not clear because of this comment: https://answall.com/questions/400473/n%C3%a3o-can-access-%C3%A0-fun%C3%A7%C3%a3o/400480#comment786145_400480 . Now, if you say that you tried something and it went wrong, why is that attempt not in the question? The way it is there’s no real doubt, it could have even closed as out of scope because it’s just asking to make the entire code of the array, which only the author knows how it should be. If you have a specific question, you should post this question completely, show what you tried.
– Maniero
Those marked as duplicate may or may not answer the question, because it has a context that indicates it is something else. In fact I analyzed the questions posted and it seems that do not answer (not sure why the question is not clear), one of them certainly does not answer because it shows how to print a associative array which is not the case. Two others even have a loop, I don’t know why they were indicated. The one he asked before does not say anything about the mistake he is having now, I myself indicated to open another question, but the question should state the problem. The Prob. is another only ñ is clear
– Maniero
Those marked as duplicates, I do not agree, my duplicate marking refers to the question that he himself has already made about 2 hours, this question here is a duplicate of the other of the same author and same text and classes ... just note ...
– novic
@Virgilionovic But different problems...
– Woss
The problem is the same @Andersoncarloswoss note he wants to print the
array
and asked two questions because he was not satisfied with the answer of the first and certainly does not understand the philosophy of the site ... he wants to do the same thing with thearray
.– novic