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
answer58
viewsHow to Backreferencing with Regex in PHP?
Backreferencing to use the same text again in Pattern and leave another group in substitution only. It may have been confusing, but what I want is this. The String is this: $Str = ' <p>Os…
-
0
votes1
answer218
viewsCoffeecode Router Error 400 on all routes
Good morning, good afternoon or good night. I am learning to use the Coffeecode Router component but it always returns me the 400 error regardless of the route I access, I did a search and did not…
-
0
votes0
answers208
viewsPhp 7.3 I am unable to connect to Firebird
Person who can help me I’m already a week cracking my head I bought a system and the bank and Firebird file fdb version 2.5 I want to assemble another program but I need to align the banks, until it…
-
0
votes1
answer56
viewsHtml form is not calling php
I’m making a simple php script that receives the login data from an html form, only apparently html is not calling the php script. snippet of html code: <form action="index.php" method="post">…
-
0
votes1
answer37
viewsExtract joint data from a JSON using PHP
I have the following JSON structure { "trophy_name_XPT001": "Text Name 01", "trophy_desc_XPT001": "Text Desc 01", "throw.except.und": "Error", "nav_bunt_852": "Zoom Out", "trophy_name_BHTLN": "Text…
-
0
votes0
answers35
viewsQuery of two or more mssql Pdo tables
Query of two or more mssql Pdo tables, the connection is normal. I’m having a little trouble. I have 2 tables. profile id | name | birth date | Address connections id | idperfil | data I’m trying to…
-
0
votes0
answers23
viewsHow to select a text within a string using php
I am using PHP. I would like to select a name or several according to what is passed in a string, and return that selection in bold. Ex: This code already returns my name, but only if it is a…
-
-1
votes1
answer176
viewsWordpress with php 7+
I upgraded my server to php version 7, but I can’t access the site. It follows error message. A página de site.com.br não está funcionando site.com.br não consegue atender a esta solicitação no…
-
-1
votes1
answer257
viewsInstall Magento Community Edition in PHP 7.2.1
I am trying to install Magento Community Edition 2.2.3 but it appears the following error: Your PHP version is 7.2.1. The required PHP version is 7.0.2|7.0.4|~7.0.6|~7.1.0 Can anyone tell if Magento…
-
-1
votes2
answers108
viewsView project - PHP
I’m starting in PHP language and would like to know how I view my project, since when using localhost the error "404" appears with the message "Not Found". The directory of my file . php is this: C:…
-
-1
votes1
answer38
viewssimplify a great IF!
I have the following condition to test: if (isset($_GET["cadastrarMembro"]) && ( $_SESSION["acesso"]["idAcesso"] == 3 $_SESSION["acesso"]["idAcesso"] == 5 $_SESSION["acesso"]["idAcesso"] ==…
-
-1
votes1
answer261
viewsHow to put 3 parameters in input value? Laravel 5.7
I need to put a default value in a text input. The default value will be 'Brazil', but I’m using the old helper in Blade and I don’t know how to enter this default value. the code I’m using is this.…
-
-1
votes2
answers54
viewsSorts PHP Array Frequency
I would like to know how to order this Array, placing the repeated numbers at the end. $arr = array( 5, 4, 2, 3, 2, 1 ); sort ($arr); foreach ($arr as $n => $valor) { echo "$valor\n"; }…
-
-1
votes1
answer31
viewsWhat’s wrong with this code?
Where am I missing when updating this code to php 7.4. File "controls/connected.php" <?php // DADOS DA HOSPEDAGEM $endereco = "localhost"; $usuario = "root"; $senha = ""; $banco = "teste"; //…
-
-1
votes0
answers17
viewsCan someone help me with this python code?
I need to know the functionality of this python function so that it serves what it does and needs to transform it into the PHP programming language. def word_to_int(word): value = 0 exp = 1 for i in…
-
-1
votes1
answer134
viewsExtension pgsql Does not load in PHP7.x
I am changing from PHP5 to PHP7 in windows 10 (development machine), all my settings have gone up good, Mysql, Firebird, PDO Mysql, PDO PGSQL, but the blessed Native PGSL does not go up, I have…
-
-1
votes2
answers630
viewsObject not found! error 404 xamp
In this project I’m having trouble finding the route /admin I created, accessing the site index('/') the route that was set works normally, however access the admin index('/admin') the file is not…
-
-1
votes1
answer39
viewsError calling Setter PHP method with Interface!
Talk guys, all beauty? I am studying Interfaces in PHP and am having an error invoking the Setter method in my attributes. <!-- User Interface --> <?php session_start(); interface User {…
php-7asked 5 years, 10 months ago Vitor Couto 158 -
-1
votes1
answer126
viewsHow to skip an entire row only if the field is empty in PHP?
I am generating an sql script for a csv file. I would like to generate the sql file only where the id field is not empty. if the field is empty it jumps the line and does not generate that line in…
-
-1
votes2
answers93
viewsHow to validate return of a method like php7 object array?
So I was able to create a class with a method for verify if the return of one another function is a boolean: Technically and there would enter the orienteering of you, it works like this: class…
php-7asked 5 years, 7 months ago Carlos Rocha 1 -
-1
votes1
answer96
viewsClass does not connect with PDO to the database and another class in the same path yes
I’ve got the spread connection: <?php namespace classes\conexao; use PDO; class Conexao { private static $instancia; private static $host = "localhost"; private static $db = "mvc_crud"; private…
-
-1
votes1
answer20
viewsError in generation of sql with datetime
I got the following method: public function inserir (ClientesModelos $_cliente) : bool { $sql = 'INSERT INTO clientes (data, nome, sobreNome, nascimento, documento, telefone, celular, email, senha,…
-
-1
votes1
answer236
viewsHow to add values in the middle of a foreach?
I have a foreach which mounts several tables, but has a td in my table he is the sum of others td. I tried to do with Javascript and put together some PHP, but without success. The field is the last…
-
-1
votes1
answer98
viewsHow to divide a variable by the values of an array in php
I want to take the value of a variable and make a division by the first value in the array and the result divide by the next value until it reaches 1. I was able to do the division, but it is not…
-
-1
votes1
answer219
viewsHow to remove a phrase within a TXT file
Say hello to the boys, I’m needing a help, I want to remove a KEY inside a TXT file but I’m not getting. Keys.txt: aLZkGWPXTLVdpVl w17AzQZIy22soy9 rAcEiWHwopYz2Pk uKPhbc0Xok5a2aO my code . php:…
-
-1
votes1
answer59
viewsMake dynamic calculations in JS and display in a PHP list
I’m setting up a ordering system and within it, I’m showing the products I have registered. So far no problems. Within this list, I need to dynamically calculate the quantity input with the value…
-
-1
votes1
answer43
viewsHow do I create a counter inside a FORELSE or FOREACH in Laravel?
I am displaying a list of system members. But I would like to display only 10 members using the syntax @forelse in Laravel. How do I implement a counter that displays only the first 10 records in…
-
-1
votes0
answers24
viewsWarning : PDO :: query(): SQLSTATE [HY000]?
You’re making the following mistake: Warning : PDO :: query(): SQLSTATE [HY000]: General error: the mode must be an integer in C: xampp htdocs joel_php curso_hcode DAO sql.php on line 34 Fatal error…
-
-1
votes0
answers9
viewsFatal error : Undetected error: Call to a member function run() on bool in C:
The following error in my code is occurring: Warning : PDO :: query(): SQLSTATE [HY000]: General error: the mode must be an integer in C: xampp htdocs joel_php curso_hcode DAO sql.php on line 34…
-
-2
votes1
answer72
viewsCount counting it wrong?
I have the following call to a function: $exitente = $membrosDao->pesquisaMembrosNasFuncoes( $_POST[ "idMembro" ] ); That for the requests below print "<pre>"; print…
-
-2
votes1
answer126
viewsSum line in matrix
I implemented this code to sum line by row of the matrix and tell which row has the highest sum, but the output is blank, in which case the sum would be line 1 (1+1+1+1) line 2 (0+1+0+1) and so on.…
-
-2
votes1
answer147
viewsfunction to convert object into array does not loop into foreach
I made the function down to pass by one Object of PHP class for a array, also PHP. /* Converte um objeto em array() */ public function ObjToArray ($_obj) { $array = null; print_r( $_obj );…
-
-2
votes2
answers189
viewsAdd array at the end of another array in a foreach
$celulas = array ( 0 => array ("idCelula" => 17,"nomeCelula" => "Célula 1" ), 1 => array ("idCelula" => 18,"nomeCelula" => "Célula 2" ) ); foreach ( $celulas as $celula ) {…
-
-2
votes1
answer45
viewsHow to search for all classes found in a tree?
Imagine the setting where I have the following structure of tree: class / conexao / conexao.php mvc / modelos / PessoasModelos.php visoes / PessoasVisoes.php controles / PessoasControles.php util /…
-
-2
votes1
answer32
viewsError passing Date as parameter
I’m creating a class with methods parameterized. The dice sane fictitious: <?php require_once '../../../erros.php'; class ClientesModelos { private $idClientes, $data, $nome, $sobreNome,…
-
-2
votes1
answer83
viewsLaravel does not generate error while processing form with 'post'
I’m taking a course of Laravel, and in the course the instructor used a form that points nowhere to show a mistake of the type MethodNotAllowedHttpException. Until then, fine, but when processing…
-
-2
votes1
answer81
viewsclass does not load outside of require using autoload
I have the page below: <?php require_once '../config.php'; require_once 'config.php'; ?> <!doctype html> <html> <head> <meta charset='utf-8'> <title><?php echo…
-
-2
votes2
answers169
viewsPHP Undefined Variable - I can’t assign a value to POST
The goal is to log in using the CPF or NIS number. However I am not able to assign values by the POST method to the $CPF and $NIS so the login is never performed. <form class="form" method="POST"…
-
-2
votes1
answer53
viewsPassword Protection in PHP
I have a function implemented in my system that makes the password storage as follows: function codifica($usuario, $senha){ $codifica = crypt($senha,$usuario); $codifica = hash('sha512',$codifica);…
-
-2
votes2
answers198
viewsPHP page does not receive data via POST
I’m having a problem, for some reason my script does not receive data from a form, however if I send the form to the same page, it gets. Following form: <form method="POST"…
-
-2
votes1
answer69
viewsHow to execute a require_once within a method of a function being passed as a parameter of another function?
I’m trying to understand and make a PHP router. index php. <?php require_once 'config.php'; require_once 'router.php'; ?> config.php <?php error_reporting(E_ALL); ini_set('display_errors',…
-
-2
votes1
answer94
viewsFPDF Code128 Barcode Error
I am trying to generate a PDF file using FPDF and a class "Code 128 barcodes" (found in fpdf.org > scripts > Code 128 barcodes). The method Code128() is inside the archive Code128.php in class…
-
-2
votes1
answer27
viewsWrite many inputs to bd
<form method="POST" action="proc_editar_despacho.php"> <div class="form-group"> <div class="card"> <div class="card-body"> <label…
-
-2
votes0
answers11
viewsAccentuation in Cakephp
Hello, my dear! The doubt below is well Noob, but it’s burning my neurons... I recently installed Cakephp 4.2.8, PHP 7.4.9. I’m walking through the Cakephp tutorial, and I made a Bake for one of my…
-
-3
votes2
answers980
viewsIndefinite Index - PHP
In my PHP code, even with Mysql and Apache linked, error appears Notice: Undefined index: name in C: xampp htdocs store add-product.php on line 4 Notice: Undefined index: preco in C: xampp htdocs…
-
-3
votes1
answer233
viewsPHP - "Notice: Undefined variable"
I am implementing a code written in PHP 5 for PHP 7, however, I am receiving this warning (it is a form), when filled in the notice somem, and are normal. Code: <?php function base64($string) {…
-
-4
votes1
answer37
viewsHelp with installing php 7.0 in Ubuntu as per video tutorial
Following this tutorial video https://www.youtube.com/watch?v=onVSVC_C1GE&t=717s. Already at the beginning of the default change, made the default changes, the default Nginx index should be…
-
-4
votes1
answer45
viewsAdd input to an array loop
for($i=0; $i<count($produtos); $i++) { $itens = array(); for($j=0; $j<count($especificacao); $j++) { if ($produtos[$i]["produto_id"] === $especificacao[$j]["prod_espeficacao_produto_id"]) {…