Questions tagged as 'php'

2
answers

Use of methods in php object orientation

Hello, I have the following question: In this example: class produtos { public categorias = []; } Categories is a vector, as you can see. Its structure is as follows: $categorias["tvs"][0] = "aqui o modelo da tv"; $categoria["pcs"...
asked by 27.09.2016 / 18:01
3
answers

What happens in the expression "$ a +++ (++ $ a)"?

I was joking with PHP to see if I could find something that sounded strange with the syntax, inspiring me in the question What happens in 1 ... 1 in PHP? . I ended up with the code: $a = 0; $a+++(++$a) The above "joke" returned 2...
asked by 05.08.2017 / 21:14
5
answers

Skip Registration within a while

I would like to know how do I skip a record within a while? For example, when type is 2 it jumps while($pessoa = mysqli_fetch_object($query)){ if($pessoa->tipo == 2){break;} //continua a exibição de pessoa } However, when running th...
asked by 16.06.2017 / 19:42
4
answers

Insertion of point every 5 characters

I have the following string: "AAAAABBBBBCCCCC" There is a script that places a "." every 5 characters? In case this script would return: "AAAAA.BBBBB.CCCCC."     
asked by 20.12.2014 / 04:31
1
answer

Broadcasting with Laravel

I'm creating a chat and for this I need to do a real-time mode so I do not have to be pinging several times on the server SignalR that does this service, I'm working with Laravel-PHP and read the documentation Broadcasting , but I...
asked by 17.07.2018 / 19:43
2
answers

Email limit received from the same domain

There are SPAM source verification policies that are based on the amount of emails that a particular domain is sending per hour. These policies can be internal such as those applied by Google, or general as is the example of lists of SPAM....
asked by 29.10.2014 / 23:06
3
answers

Use .on () instead of .bind () in CakePHP's JsHelper

When I write Ajax with CakePHP's JsHelper, if I write something like this $this->Js->get('#searchCity')->event( 'click', $this->Js->request( 'http://api.geonames.org/searchJSON', array( 'async...
asked by 14.02.2014 / 13:31
4
answers

How to know the number of lines a large file has in php?

How do I know the number of lines in a file using PHP? I know there are functions like file , which returns all rows of the file in array . We could simply use a count , but the problem is that I need to do this for a 60m...
asked by 13.05.2016 / 18:55
2
answers

Get AUTO_INCREMENT value from a table

I want to get the last record entered in a database table, that is, the value of AUTO_INCREMENT of the table, I tried using: SELECT MAX(id) as max FROM people It works, but if I do not have any records in the table it will return...
asked by 06.07.2016 / 19:10
2
answers

Is it possible to access the same argument twice in sprintf?

In PHP time the function sprintf . With it we can format the values sequentially passed from the second parameter. For example: sprintf('Meu nome é %s e tenho %d anos de idade', 'Wallace', '26') The output will be    My name is...
asked by 08.07.2016 / 18:33