Questions tagged as 'php'

1
answer

Is there timezone for Brasilia?

I'm developing an app in PHP. And you need to set Timezone to Brasilia. But in the php documentation I have: $timezones = array( 'AC' => 'America/Rio_branco', 'AL' => 'America/Maceio', 'AP' => 'America/Belem', 'AM' => 'Ame...
asked by 29.11.2017 / 16:01
2
answers

Why can not I use $ this inside a static class?

In the example below, I wanted to know why I can not use $this inside a static class ? <?php class A{ public static function hello(){ echo 'hello'; } } class B extends A{ public function ok(){ echo...
asked by 16.12.2015 / 04:24
2
answers

Calling function from its name in a PHP class [duplicate]

I'm creating an application where I need to call the function based on its name inside the class. the intention of using it this way is that I can call these functions through ajax and the server will understand without having to do a switc...
asked by 21.12.2015 / 19:46
2
answers

Is there any difference between an infinite loop with for and while?

In PHP, you can generate an infinite loop with while simply by passing the true parameter. Example: while (true) { echo "Ao infinito e além"; } It is also possible to generate this through for , simply omittin...
asked by 01.10.2015 / 22:55
1
answer

SQL query within another query

I'm performing an update on the database, but it needs to get the last ID that was written. Where does where I put another command in? In this way: $sql = mysqli_query($conexao, "UPDATE cadastro set...
asked by 01.10.2015 / 19:56
1
answer

How to convert NFA to datatime and vice versa?

Having a date (ex: 2017-01-18 11:08:09 (format Y-m-d H: i: s)), the generated NFA results in A70171480. Searching, I found little, even more in Portuguese. To be honest, I have not yet seen enough reason to use it (so far as I understand it to...
asked by 31.01.2017 / 14:13
3
answers

How to repeat columns up to "x" times

I have a column in my database with names, I write it on the screen, through this code: <html> <head> <title>Pagina Inicial</title> <meta charset="utf8"> <link rel="stylesheet" type=...
asked by 28.09.2015 / 01:04
2
answers

How to compress images in PHP?

On my site, people can post messages and along with these messages an image (which is saved in a folder). I would like to know if there is any class or some means using PHP to compress these images without losing quality. Note: Extensions ac...
asked by 13.03.2015 / 20:02
2
answers

How to sort the results of a ranking?

I'm developing a game, and in it I need to do a ranking according to the time it took the user to reach the end of the game. My question is, what kind of data should I use in my database to be able to organize when displaying the ranking?...
asked by 15.09.2015 / 19:05
1
answer

Customizing a Laravel user model 5.4 - Login problem

I have tried everything already, but I can not solve a problem with the login system of Laravel which is this: I created a model called Usuarios , I put all the information in it that has to be properly placed, like the array $fi...
asked by 02.03.2017 / 19:31