Questions tagged as 'php'

1
answer

What is and how does PHP's PHAR function work?

Does anyone have information about the phar function? What is it, what is it for, how is it used and what is the advantage? I found a lot on the internet, but nothing so specific, so I decided to ask.     
asked by 10.04.2017 / 01:22
2
answers

What types of attacks can I experience with global variables and how to prevent

Thinking about creating a system of login and secure registration, I want to take some measures, as I have been reading, I have verified several errors that I made, especially regarding Global variables: link Ex: I always validated my su...
asked by 25.03.2015 / 21:26
1
answer

Validation configuration in dynamic fields

I have a problem that is as follows, I have the fields: Name, Age and Text; In a part of the system I register that the Text field will only appear if the Name field is equal to PH and the Age field has the value 20 with both tr...
asked by 21.05.2015 / 20:36
3
answers

Assign type to parameters

Is it possible to assign types to the parameters in functions in PHP? Example: public function random(int $length) { // ... }     
asked by 07.03.2015 / 23:30
3
answers

What is the purpose of {} in the code below? and what is the definition?

$objeto->{'getEndereco' . ucfirst($tipo)}()->getCep();     
asked by 04.07.2017 / 14:59
5
answers

How to import a variable inside a function of a class?

I would like to get the $valortotal and take it into a function of a class as can be seen in the example below. Thank you. $valortotal = 15.00; class CreatePaymentRequestLightbox { public static function main() { $pedid...
asked by 19.05.2015 / 22:10
2
answers

How to create and manipulate lists in PHP?

In java it is possible to create and manipulate list of any data type using List<E> , see the example below: List<String> lista = new ArrayList<>(); lista.add("Stack"); lista.add("Over"); lista.add("flow"); I created...
asked by 06.10.2016 / 15:21
3
answers

Include / Require 'file.php' or Include / Require ('file.php')

I know PHP allows the inclusion of files in both modes, but I would like to know the correct way to use these functions, or if both modes are correct.     
asked by 11.04.2014 / 19:25
2
answers

Parse error given when checking variables with empty () function

I have a problem with my PHP when I pass more than one variable for it to check separated by a comma it generates a parse error. Look at my code below: if (isset($_POST['btnCriaTempo'])){ $ordem = trim($_POST['ordem']); $time...
asked by 10.01.2014 / 00:14
2
answers

How to prevent CSRF attack without PHP frameworks?

I have the following files based on other scripts I've tried to study: authenticate.php <?php session_start(); if (isset($_POST['token'], $_POST['login'], $_POST['senha'])) { $token = empty($_SESSION['token']) ? NULL : $_SESSION['to...
asked by 23.02.2016 / 00:54