Questions tagged as 'php-7'

1
answer

In PHP 7, can the class method contain a keyword name? this is good or bad?

PHP 7, has released a number of innovations for the PHP language. Also, I noticed that classes can now have methods with keyword names. The strange thing is that classes can not have, but methods can (vixe!) For example, this is valid in PHP7...
asked by 16.05.2016 / 16:38
3
answers

Variable is not updated in constructor

I'm learning OO and venturing into PHP, but I've come across something I believe in theory should work, but in practice it does not. <?php class Users{ public $name; public $idade; public $email; private $senha; function __co...
asked by 30.08.2016 / 23:04
2
answers

Is there a try-with-resource in PHP?

Is there something like PHP try with resource in Java? Or do I have to close resources in the block of finally same?     
asked by 02.10.2018 / 05:03
2
answers

How to upgrade PHP 7.0.0RC1 to the already released version 7.0 in centOS?

Good morning, How do I upgrade PHP 7.0.0RC1 to the already released version 7.0 in centOS? Thank you     
asked by 04.12.2015 / 13:04
1
answer

Problem using $ _SESSION in PHP 7.1.10

I have two servers running PHP, one in the 5.4.45 version and another 7.1.10 . When running the files below in the same url, only the older version of PHP shows the values of the "Test" session. In the 7.1.10 version the Array is empty....
asked by 24.10.2017 / 03:41
1
answer

What exactly does the DateTime :: createFromImmutable () method serve?

What exactly is the DateTime::createFromImmutable() method for? Implemented according to release note of PHP version 7.3.0.     
asked by 21.12.2018 / 02:36
2
answers

Access the instance of the main class from an anonymous one in PHP 7

I'm trying to access the instance of the class where it contains an anonymous one as we do in Java, for example: JAVA class MyClass { private String prop = "test"; public void test() { new Runnable() { pub...
asked by 11.07.2017 / 18:35
1
answer

Ternary operator "?:" [closed]

I recently got into a discussion with coworkers about the more compact functionality of the terabyte (x?: 10) and some of them said that it would be removed in php 7. I did a web search and found nothing related to that. Is there any informat...
asked by 04.08.2017 / 19:44
1
answer

Problems with date transform function

$data = $_POST["data"]; // Recebe a variável com a data, e cria um objeto DateTime a partir do formato especificado. $objetoData = DateTime::createFromFormat('d/m/Y', $data); // Reformata a data do jeito desejado $data =...
asked by 14.12.2018 / 03:18
2
answers

Why has the "salt" option of password_hash been discontinued in PHP 7?

I'm getting the error while trying the following test: [ "salt" => "um salt grandão de responsa", "cost" => 12, ] password_hash (123456, PASSWORD_DEFAULT, $options); Returning:    Use of the 'salt' option to password_hash is dep...
asked by 25.01.2017 / 11:41