Questions tagged as 'php'

2
answers

Request for a form with laravel not working

I am making a request from my controller for a form in the view, it is giving this error. I tried several methods but none solved. Controller:publicfunctionstore(Request$request){$NomeDaEmpresa=$request->input('NomeDaEmpresa');$nCompartil...
asked by 22.02.2017 / 19:06
4
answers

Assign a value to a variable when the search return is NULL

I am trying to assign a value to a variable when the return of the search is NULL , but I am not getting it, when I check the value of the variable $IdSetor it is NULL and not zero, as necessary. > Search and what I'm tryin...
asked by 13.03.2018 / 13:49
3
answers

How to pass Id next to pagination ex: index? pag = page & ID?

I am making a website and in this site, I have a simple paging system in index.php with the following code: <?php function getGet( $key ){ return isset( $_GET[ $key ] ) ? $_GET[ $key ] : null; } $pg = getGet(...
asked by 14.08.2014 / 21:56
4
answers

Identify how many days the month has (28, 29, 30, 31) [duplicate]

Is there a native function that identifies how many days does the month ? Example: value : 2018-08 , then return would be: 31 . $dias = funcao('2018-08'); echo $dias; // resultado: 31 If there is no native fu...
asked by 15.08.2018 / 13:31
2
answers

Use function of a class inside another PHP class

I have two classes, what is the correct way to call a function from another class, so below error returns class DB { public function __construct($user, $password, $database, $host) { $this->user = $user; $this->password =...
asked by 22.05.2014 / 22:45
4
answers

How to leave active bootstrap tab after clicking pagination?

I'm with a bootstrap screen that contains two tabs, one called "Settings" and the other "Users". Within the "Settings" tab, I have a simple, normal form, already inside the "Users" tab, I have a select from the bank, and with that result I set u...
asked by 23.12.2013 / 16:45
2
answers

Methods Getters and Setters [duplicate]

In my course, I'm learning getters that gets "data" and setters , which inserts / modifies. I made my code like this for pen class: <?php class Caneta { public $modelo; private $ponta; public function getModelo(){ retu...
asked by 12.06.2017 / 20:56
2
answers

What is the purpose of & in PHP? [duplicate]

I have the following code snippet: $a = '1'; $b = &$a; $b = "2$b"; echo $a.", ".$b; Output: 21, 21 I noticed that there is no assignment to the variable $a except for the fact that $b = &$a using & , t...
asked by 05.06.2017 / 14:42
4
answers

How to choose a convention for names of variables and functions?

I'm going through the second development company and in both it does not have an own convention to use in the declarations, in the codes I get functions declared as follows:    PHP and jQuery    function nome_pessoa(); function nomePessoa...
asked by 06.10.2017 / 17:18
3
answers

Return time and minutes difference with PHP

I have this simple file: test.php <?php $date1='2018-01-09 16:14:01'; $date2='2018-01-09 17:30:04'; $dateS1 = new \DateTime($date1); $dateS2 = new \DateTime($date2); $dateDiff = $dateS1->diff($dateS2); $result = $da...
asked by 10.01.2018 / 14:17