Most voted "php-7" questions
PHP7 is a new version of the language, which has new features like: Several errors are now treated as exceptions. Removed the old SAPI API and extensions Null coalescing Operator (`?`) Combined comparison Operator (`<=>`) Return typed in methods. Declaration of scalar types. Anonymous classes Use this tag only when the question has any problem or doubt about the resources cited.
Learn more…198 questions
Sort by count of
-
0
votes1
answer253
viewsHeroku downgrade php 7.3. * to 7.2. *
I don’t know how I upgraded the php version in Heroku to version 7.3, however this version (7.3.) is causing several bugs in the application, with do I can downgrade to version 7.2. ? I have already…
-
0
votes1
answer121
viewsnamespace php7 does not find url?
I’m trying to learn namespace but I’m having a hard time. Even doing exactly as it is in a video on youtube, but it doesn’t work. I have the project folder Projeto Projeto\Cadastros…
-
0
votes2
answers66
viewsInterception and redirection
My structure localhost/sistema localhost/sistema/.htaccess localhost/sistema/site/index.php Goal: When accessing any url within the domínio occur to interceptação and the redirecionamento to the…
-
0
votes1
answer34
viewsIs PHP-specific string array possible?
Well, I have the code below that should work but gives error: function teste( string... $_array ) : array { //FINS DE TESTE return $_array; } print_r ( teste ( ["teste","2"] ) ); If I just do…
-
0
votes2
answers53
viewsFinally error with Try Cath
I’m trying to create a classe Statica for conexão at the mysql with PDO but is making a mistake in the line of finally <?php namespace CONEXAO; use PDO; class Conexao { public static $conexao;…
-
0
votes1
answer102
viewsclass does not open
My structure localhost/sistema localhost/sistema/.htaccess localhost/sistema/composer.json localhost/sistema/composer.lock localhost/sistema/composer.phar localhost/sistema/App…
-
0
votes0
answers51
views$_SERVER['LOGON_USER'] equivalent on Linux
In the company where I work, there was an ISS-based PHP5 server, however it is migrating to another Debian-based Apache server with PHP7.0. I enabled the errors of the new server, and I see that I…
-
0
votes0
answers35
viewsprivate property Static is getting touched value!
I have the class below: <?php namespace CONSTANTES; class Constantes { private $livre = true; private $util; private $site = array ( "dominio" => "crud.com.br", "www" => "www.crud.com.br",…
-
0
votes1
answer77
viewsPopulate html select with database values
Good morning, I’m a beginner in php and I’m creating a personal project to register people. I have a screen that lists all users and when clicking change user, it returns the values of the user in…
-
0
votes1
answer25
viewsconcatenation error when instantiating PDO
I have the connection PDO with mysql down below: $dsn = 'mysql:host=' . self::$hostname . '; dbname=' . self::$dbname; $opcoes = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8');…
-
0
votes1
answer236
viewsHow to realize the Seed of a Factory within another class with Phpunit/Laravel?
I was studying the framework Laravel, and I was left with the following doubt: there is a way to realize the Seed of a factory within a common project class? It would be like calling command php…
-
0
votes1
answer128
views -
0
votes1
answer47
viewsPHP, Relationship Too Much for Many
My doubt is in the construction of Logic. How do I, so that I determine item, can have more than one value? EX: I have the table of vehicles and the table of inputs. Each vehicle can have more than…
-
0
votes1
answer54
viewsIMAP Certificate Failure for imap.gmail.com error
I am developing an application where I use Imap to connect to a client’s gmail, everything works properly on the spot but when I upgrade to the server and run the code I get the following error…
-
0
votes1
answer56
viewsWhat’s the difference in using $_POST['field'] and filter_input(INPUNT_POST,'field')?
// Método 1 $campo = $_POST['campo']; // Método 2 $campo2 = filter_input(INPUT_POST,'campo'); What is the best way to get data on the form?
-
0
votes1
answer66
views"echo" shows decimal number with comma instead of dot
I have this code in PHP 7: $total_pedido = 123.90; $frete_valor = 13.98; $total_geral = ($total_pedido + $frete_valor); echo ($total_geral); // Mostra 137,88 The result of the sum (137.88) which is…
-
0
votes3
answers144
viewsDoubt - Array php return
I’m a beginner in php, and I came across the next problem. I have a function that returns me an array that comes from the database. $teste = dados($conexao); And I do: print_r($teste); It returns me…
-
0
votes0
answers2200
viewsUnexplained Error, Uncaught Syntaxerror: Unexpected end of JSON input
I’m making a chart and I’m using Chart.js, PHP and jQuery. I managed to run with the correct information, but after a while it stops working and presents the following error: Uncaught SyntaxError:…
-
0
votes0
answers11
viewsManipulate the Guzzle exception and get the HTTP body
I would like to deal with Guzzle errors when the server returns 4xx and 5xx status codes. I make a request like this one: $client = $this->getGuzzleClient(); $request = $client->post($url,…
-
0
votes1
answer37
viewsSeeking null value with get in the Doctrine Entity
Opa all right? I have a problem with values NULL with Doctrine. What happens: I have some fields in a database table where I keep some values for future validations, these fields are nullable =…
-
0
votes1
answer225
viewsErrors in mysqli, expected parameters
The following errors are appearing: Warning: mysqli_query() expects at least 2 Parameters, 1 Given in C: xampp htdocs rede profile.php on line 25 Warning: mysqli_fetch_assoc() expects Parameter 1 to…
-
0
votes1
answer1439
views"PDO" class not found after upgrading from PHP 7.2.13 to PHP 7.3.0 in Debian 9
On a Debian 9 server, I upgraded PHP from version 7.2.13 to version 7.3.0, but now PDO no longer works. Fatal error: Uncaught Error: Class 'PDO' not found. The libs are already installed: root@/#…
-
0
votes1
answer185
viewsPHP 7 typed and difference between argument numbers and parameters
Reading in: https://secure.php.net/manual/en/mi found out the following example: function arraysSum(array ...$arrays): array { return array_map(function(array $array): int { return…
-
0
votes1
answer48
viewsWhen adding HTML gives header error
page: <?php header("Content-Type: text/html; charset=utf-8"); ?> <html> <head> <title>Gceu IMW Muriaé - São Cristóvão </title> <meta http-equiv="Content-Type"…
-
0
votes1
answer757
viewsHow to run Model function in View with codeigniter?
I am using codeigniter (based on PHP and Model-Control-View). I have a controller that loads a Model and a View. [Controller] public function index() { $data['agenda_model'] =…
-
0
votes1
answer75
viewsFunction does not work within class [Laravel]
I’m trying to call one function inside another in one of the controllers of my Laravel project, but when the flame the page is all blank and presents no error. public function index() {…
-
0
votes2
answers670
viewsError Uncaught Error: Class 'Client Register' not found Using namespace
I am studying about namespaces, I wrote the code below, but is returning the following error: string(16) "Client Register" 'Client Register' not found in…
-
0
votes1
answer181
viewsInvalid Parameter number - PHP
I’m using the same code I use to make the UPDATE from another table in my bank, but when I use the code for my bank’s post table error, the only thing that’s changing is the image. I have no idea…
-
0
votes0
answers226
viewsProblems with Curl in PHP 721
So I graduated, man Notebook and I was reinstall the Apache I installed Apache + PHP 721+ Mysql. Everything works. I went to try a phone call with Curl and gave error: [Thu Apr 18 16:41:34.354241…
-
0
votes3
answers231
viewsDo require_once within the classes. Is it possible?
I’m trying to create a architecture new based on a need and I’m having some difficulty. So I decided to create an example minimum, complete and verifiable of the application. It is a architecture…
-
0
votes2
answers47
viewsPass a constructor variable to another method
I am using PDO and I want a constructor method with the database connection but the connection variable is not accessible in another method class Stock{ public function __construct(){ $conn= new…
-
0
votes0
answers31
viewsPDO displaying the populated query
Well, here’s the thing function: public function inserir (ClientesModelos $_cliente) : bool { $sql = 'INSERT INTO clientes (data, nome, sobreNome, nascimento, documento, telefone, celular, email,…
-
0
votes1
answer91
viewsDate|Time returning error
I have the Model class down below: namespace classes\mvc\modelos; use \DateTime; class ClientesModelos { private $idClientes, $data, $nome, $sobreNome, $nascimento; public function __construct (…
-
0
votes1
answer67
viewsReturn of consultation in descending order
With this code, how do I make the return of the query come in order decreasing? <?php session_start(); include_once "conexao.php"; ?> <!DOCTYPE html> <html lang="pt-br">…
-
0
votes1
answer26
viewsError in instanceof in foreach
I have the following function: public function instanciaClasseArray ( $classe, $array ) : bool { foreach ($array as $objeto) : if ( !($objeto instanceof $classe) ) return false; endforeach; return…
-
0
votes1
answer80
viewsdeclare(strict_types=1); display errors
I’m starting to use language heavily typed in PHP 7. declare(strict_types=1); But I couldn’t find a way to debug the bug and show where it is. I searched hard but couldn’t find. What should I wear?…
-
0
votes3
answers574
viewsSLIM FRAMEWORK - 404 PAGE NOT FOUND
Hello, good morning. I am trying to make a route using SLIM and I can normally access via URL and internally(via menu) the pages with SLIM configured, but when I login to the site, it does not send…
-
0
votes1
answer75
viewsHow to upload database data to Welcome view in Windows?
I am creating a system in Aravel 5.3, already activated the auth and put a Carousel in the Welcome view that searches the address of the images in the bank. When accessing the default Welcome view…
-
0
votes1
answer40
viewsMult-lingua site with regular expressions
Hey, guys, all right? I have a problem to identify the page with the language at the same time. Just pulling the index with the languages and the other pages not. This is the url expression:…
-
0
votes0
answers99
viewsHow to make explicit variable type declaration in PHP?
Taking a course on the Internet, I saw the instructor saying that from PHP 4 (he used 3, so did not test) it was possible to make the explicit declaration of type in object attributes as follows:…
-
0
votes2
answers362
viewsHow to connect PDO with named Sqlserver instances?
I can’t connect PHP 7.0.36, sqlsrv PDO drive on Ubuntu 16.04 on SQL Server 2012 when the database has a appointed body. When do I use the standard instance works. $conn = new…
-
0
votes1
answer45
viewsHow can I compare a password of my DB with that of php
I’m logging in to my website but when I use one query to remove the DB password it comes in a hash and my doubt and how can I hash the passoword that the user put and bought with the DB? To register…
-
0
votes1
answer22
viewsHow to create a new instance instead of pointing to the same instance when defining variable?
When defining a variable of type Carbon i cannot copy the object (create new instance with the same properties), just point to the same instance, forcing me to create new objects manually. Example:…
-
0
votes0
answers41
viewsReturning only one result, how to return all?
Please someone help me, I need to return all the data. but it only returns the first one how do I return all results , the code I am using is this try { $opts = array( 'http' => array(…
-
0
votes2
answers150
viewsCreating php product page
php and I have the product.php page, when clicking the product on the home page, I want you to redirect to product.php page showing the data of the particular product I clicked, I started the code…
-
0
votes1
answer37
viewsHow to configure phpunit with Scrutinizer?
Following the document of Scrutinizer I realized the creation of the archive .scrutinizer.yml in the project in PHP. Analyzing other sites got to the final result of the file demonstrated below:…
-
0
votes1
answer329
viewsCheck if registration already exists (Codeigniter)
I am developing a scheduling system (automotive sector). The idea is for the user to choose an installer(ComboBox), Schedule(ComboBox) these times are already predefined and the date(Input/Date). I…
-
0
votes1
answer84
viewsDeserialize Object in array after json_encode
I have an array of objects. But before sending these objects in the array, I do serialize() in each index of the array because they are objects: function serialize(){ return…
-
0
votes2
answers665
viewsMailer Error: SMTP connect()
This class was created to send product purchase information to the email box, but an error ("Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting")…
-
0
votes2
answers105
viewsPassword_verify() problem in PHP
My intention is to call a page redirect if the password is not correct using header(), however, I realized that it was not working. I’ve been reducing the tests and I’ve come this far: // Senha…