Questions tagged as 'php'

1
answer

Problem making JSON to a Site

I need to make JSON from the following link, in order to get the data for a record AWP | Dragon Lore (Field Tested) of the day: 2017-03-25 . Link: link How can I make a json, in order to get price , of the follo...
asked by 26.03.2017 / 01:56
3
answers

What is the reason for this IF / ELSE assignment?

Because in this code the 0 is assigned to IF and the 1 value is assigned to ELSE ? <?php $flipCount = 0; do { $flip = rand(0,1); $flipCount++; if ($flip){ echo "<div class=\"coin\">H</...
asked by 01.10.2014 / 18:48
3
answers

What is the correct option for instantiating a class in PHP?

What is the correct option for instantiating a class in PHP? Whereas the class is under discussion if you call Atleta : 1) $atleta=Atleta; 2) $atleta= new Atleta(); 3) $atleta= Atleta(); Which of the 3 options is...
asked by 09.11.2016 / 12:11
3
answers

How to use an object to add to an attribute?

When I do the code below you get this error:    Object of class Client could not be converted to string in ... \ animal.class.php This part does not allow me to pass an object to be used in the "owner" property $dog = new Cachorro('Rex'...
asked by 29.12.2014 / 05:18
2
answers

How to print the SQL statement being sent to the bank?

I would like to know how to write a SQL for control purposes of the statement being sent to the database: $sql = $pdo->query("SELECT * FROM imovel WEHRE CATEGORIA = 'APARTAMENTO'"); How to print the SQL statement being sent to the bank?...
asked by 03.10.2014 / 18:34
3
answers

Echo returning wrong value

I do not understand one thing in this case: $arr_4[] = "$arr_3[$i]<sup>$arr_22[$i]-$contador+$eletrons</sup>"; Come on, the $ arr_3 [$ i] stores a string value "3d", the $arr_22[$i] = int (10) , the $contador = int(30) %...
asked by 13.10.2014 / 18:15
2
answers

How to create a Grouped List in Laravel 4 from an entity with self-relationship

I'm trying to create a select box com \Form::select() (grouped list) in Laravel 4 and I have the following entity: Items id = id do item nome = nome do item pai = fk dessa mesma entidade I have already created the model with hasMa...
asked by 12.12.2013 / 12:06
3
answers

When should I use empty or isset?

I noticed that some people have doubts about the use of these two functions, or if they have no doubts, they seem to unnecessarily apply one of these functions, and in some cases the other functions better. For example, to verify that a value...
asked by 07.10.2015 / 21:53
2
answers

get_called_class or new static?

I do not remember which library in PHP I saw this, but there was a code snippet where, to get a new instance of the current class, the get_called_class function was used. However PHP has the keyword static , which refers to late...
asked by 03.10.2015 / 18:58
2
answers

How to resolve error Catchable fatal error while trying to show messages

I have a page where I check if the user has filled all the fields of a form but when trying to show the messages to the user script returns me an error, I'm doing this: class SendEmail { private $nome; private $email; p...
asked by 04.12.2015 / 12:02