Questions tagged as 'php'

3
answers

Verify that the value of $ _GET is a Integer

I'm having trouble checking if the value of $_GET is integer. Here is the code: <?php $modo=$_GET['PG']; if(is_int($modo)){ echo "e inteiro"; }else{ echo "n e inteiro"; } ?> Even though I p...
asked by 04.06.2018 / 15:39
3
answers

What is 'final' in PHP?

I was in Github and came across a class like this: final class Noticia { [...] } What is the purpose of this final reserved word? Can only be used in classes?     
asked by 07.08.2017 / 22:35
4
answers

Foreach in PHP inverse process

I have the following foreach (): $i = 1; foreach($listagem as $valor){ echo $i; // O que vai me retornar: 1, 2, 3, 4, 5, ..., 100 $i++; } How do I do the reverse process? I would like to return: 100, 99, 98, 97, ..., 1     
asked by 01.08.2017 / 22:02
7
answers

Is there a problem if I leave a php file containing only HTML code?

I have a php file on my site that serves as a template for a single page of the site, inside this file there is only HTML code, it has no php <?php ?> tag, nor anything. It's like an html file, but with the .php extension My ques...
asked by 27.08.2014 / 22:32
2
answers

IF syntax within an ECHO

I'm having a syntax problem when trying to put a if inside a echo in PHP. Check out the code: foreach($resultadoBusca as $escrever){ echo "<tr><td>" . $escrever['cod_votoran'] . "</td> <td>" . u...
asked by 24.10.2014 / 10:37
5
answers

Login system with PHP [closed]

Hello, I need to do an administrative area, and obviously I need a login system and password. I know there are already questions here, but I fear they are outdated. I want a way inside the simple and safe possible. I also do not want anyone to d...
asked by 07.12.2015 / 18:46
2
answers

Masking credit card numbering

I have the following numbering: 4716501731980995 I need to split it into 4 parts. Part 2/3 should be replaced by **** **** How could I do this?     
asked by 01.08.2017 / 22:35
5
answers

How to correctly count items?

How can I change this code below? It takes the numeric values placed in MySQL in the comma separated table by placing them in the 1,2,3,4,5,6,7,8,9,10 table. Then it counts the total of items placed in this table separated by the comma...
asked by 14.11.2014 / 20:39
4
answers

How to construct a class correctly with access methods?

How do I join multiple variables into a single object? How do I get the following code? <?php class Produto { //Atributos var $cpu; var $mb; var $psu; //Getters & Setters function setProduto($produto, $produto1)...
asked by 14.09.2017 / 01:00
4
answers

Calculator in php

How do I make a calculator in php? I made the code but it does not display result. <!DOCTYPE HTML> <html lang = "pt-br"> <head> <title> Exemplo</title> <meta charset = "UTF-8"> </h...
asked by 04.04.2014 / 20:07