Questions tagged as 'php'

2
answers

How to "simulate" a Generator in versions prior to PHP 5.5?

As of PHP 5.5 we can use yield instead of return in functions and, with that, we create Generators . The reasons for using yield can be seen here What are the advantages of using a Generator (yield) in PHP? But...
asked by 01.09.2015 / 17:42
1
answer

mysql + PHP - use or not use mysqli_close ()

I noticed now that I'm not using the mysqli_close() function indicated on the PHP.NET site I monitor the connections through Workbench client conections and do not get open connections, my question is if this way that I'm programmi...
asked by 02.09.2015 / 16:35
2
answers

Regex - taking certain values - PHP

I'm in doubt, tried to read several articles about regular expressions, but it still did not fit my mind, I'm confused. I have a certain string vid..0002-3f3c-458c-8000__vpid..e29ac000-8020-395e__caid..8ff77872-a0cb-4d7c-a36c0bd6__rt..D__lid.....
asked by 07.09.2015 / 16:09
1
answer

What is the difference between __CLASS__ and get_called_class?

In PHP, I know two methods of displaying the name of the current class being called: through the magic constant __CLASS__ and the get_called_class() function. Apparently, they both do the same thing. class A { public sta...
asked by 31.03.2016 / 19:08
1
answer

Creating tables with PHP

Expensive; I have a problem and I need a little help. I have a page in html that contains some radio buttons. By clicking on a radio button and then the submit button, it redirects to a page in PHP that captures the value of the radio and wit...
asked by 14.09.2016 / 21:36
2
answers

How to sort array in decreasing order?

I have the following problem, after doing a array 'push, I want to return the amount of repetition of a term for this I did: $key = str_replace(array(',','.','https','/','#','!','@','&','?','\',':','\'','”','(',')', 'ª','º','1','2',...
asked by 14.09.2016 / 23:49
2
answers

Classification system

I would like to make the positions appear. I have no idea how. Below I'll be giving a demo and my code <?phpinclude("./configs/dados.php"); $ranking = "SELECT * FROM usuarios ORDER BY pontos_total Desc LIMIT 3,10"; $limiteranking = mysql...
asked by 16.09.2016 / 23:56
1
answer

Identify if and endif with regex?

In an example of OS I found: <?php $a = 22; $b = 33; $template = ' [if $b>0 ] B > 0 [/if]'; // IF - ENDIF preg_match_all('/\[if(.*?)\][\s]*?(.*)[\s]*?\[\/if\]/i', $template, $regs, PREG_PATTERN_ORDER); for ($i = 0; $i < coun...
asked by 20.09.2016 / 00:30
1
answer

Problem with facebook API

On the site, I'm using the facebook API to login, but when I try to login through the facebook button this message appears:    Unable to load URL: The domain for this URL is not included   in the application domains. In order to load this URL...
asked by 24.10.2016 / 12:35
3
answers

Compare day and month of a date?

In MySQL I have saved the date of birth of a person, I need to set up a query to return the birthdays of the week, those that make today's birthday until today + 7 days. p> I'm trying like this: //Metodo da tela de listagem public fu...
asked by 28.10.2016 / 16:22