Questions tagged as 'php'

1
answer

How to turn E_PARSE errors into Exception in PHP?

My question is: PHP has a great feature that allows you to convert errors that can occur in an application to Exceptions . This can be done through the class ErrorException Example: set_error_handler(function ($errno, $errst...
asked by 15.01.2015 / 18:15
1
answer

What is the name of the operator (double colon) in PHP?

In PHP, it seems that this :: operator has a Hebrew name (I do not know why someone would use Hebrew), Paamayim Nekudotayim . I have trouble always when I have to explain to someone the name of this operator, since I do not know...
asked by 10.09.2015 / 17:32
1
answer

Is the __destruct method useful?

I read about the __destruct method on these two links: link link And I have not yet found the utility of the __destruct method, even more than @ user166390, (the user who answered the question of the 2nd link) said:...
asked by 23.12.2015 / 20:28
1
answer

HMVC and HTML Component

I've read several articles on HMVC, both in PHP and other languages, and in all of them the implementation of the standard revolved around having a "Controller-master" which requested the Response Body in> one or more resources, internal or ex...
asked by 15.12.2014 / 18:15
1
answer

How to change content on a page?

I'm trying to change some fields of a website, what I want is to open this site in my address, but with some of its content changed. I'm using file_get_contents to open the site, but I have two problems: When I click on a link with...
asked by 21.02.2015 / 23:47
1
answer

Friendly Url in PHP and Sql

I have the following php code to make my site urls friendly: <?php $atual = (isset($_GET['pg'])) ? $_GET['pg'] : 'home'; $permissao = array('home', 'contato', 'sobre', 'politica'); $pasta = 'arquivos'; if (substr_count($atual, '/') &g...
asked by 01.02.2015 / 03:46
3
answers

How to do PHP and MySQL pagination?

I want to make a pagination on my blog. I will not have 50 posts on the first page, so I want to limit the page to the last 15 posts added and then clicking the "older posts" button will show me the oldest posts. In the background I do not want...
asked by 23.07.2014 / 16:14
4
answers

Trying to condense conditional with three possibilities

The problem is to present a result by flexing to the plural if necessary, or "none": Let ni 1 always responds "1 item". The idea is to condense an if, else if, else into a line, but not if it is possible, since the logic seems correct. Is...
asked by 03.12.2014 / 01:25
2
answers

How to use Traits in PHP?

I'm creating namespaces for my traits and using them directly, without using them within a specific class, for example: OBS: The code below is just an example. namespace Decrypt; trait Rc4 { public function nome() { retu...
asked by 10.07.2017 / 13:58
4
answers

After all, why does not the PHP source code appear in the browser?

Well, I know that PHP is an HTML preprocessor, I know it's interpreted by PHP and it's rendered on the page but the source code does not appear. But is it really safe? I know it's possible to capture the results of the page, but I do not know to...
asked by 02.03.2018 / 13:36