Posts by Bruno Augusto • 8,661 points
187 posts
- 
		15 votes2 answers2639 viewsA: How to hide source code from PHP file?There are ways to protect the code, however, the best, Zend Guard and Ioncube, are commercially licensed. The code is obfuscated which makes Reverse Engineering quite difficult because, basically,… phpanswered Bruno Augusto 8,661
- 
		7 votes1 answer3650 viewsA: Sort object arrayFor these and other cases, usort() is who you seek. However, slightly different from the manual examples, you should inform the properties that will be used as a basis for comparison. It’s not much… 
- 
		1 votes3 answers657 viewsA: Save current time to a file . txtFor your very brief explanation, what I could understand is that you want to simply record a certain timestamp in a text file. If you first thought of AJAX, you should at least keep in mind that… javascriptanswered Bruno Augusto 8,661
- 
		38 votes6 answers64346 viewsA: What is the difference of API, library and Framework?According to Wikipedia: API API, of Application Programming Interface (or Application Programming Interface) is a set of routines and standards established by software for the use of its… 
- 
		2 votes8 answers16873 viewsA: How to invert a string in Javascript?So many interesting answers, I’ll leave my contribution also, created by the Project staff PHPJS, one port of strrev() of PHP: function strrev(string) { // discuss at:… 
- 
		1 votes1 answer144 viewsQ: Responsiveslides with JSON as DatasourceAfter much search for a very simple image gallery I ended up finding the Responsiveslides.js which is not only quite simple, but also works satisfactorily in smartphones (even if the latter does not… 
- 
		2 votes1 answer1514 viewsA: error in getting values from stdClass php arrayIt turns out that the square bracket syntax until some time ago was an exclusivity of the arrays. However, little by little (relatively speaking) the Objects were being improved. First they could be… 
- 
		1 votes3 answers7149 viewsA: Clear ZIP code with JavascriptI would like to complement the answer by @Renan with a true CEP validation. Although the Brazilian CEP is not defined by an algorithm itself but only one structured decimal representation of the… 
- 
		2 votes2 answers1181 viewsA: Why don’t browsers implement HTTP’s PUT and DELETE protocols?That answer is another huge comment to the answer from @carlosfigueira, but that contains some information until interesting. As for the statement that modern browsers implement others HTTP Verbs, I… 
- 
		1 votes1 answer1138 viewsA: Handle get(403,404,405) errors with jqueryAccording to the documentation of jQuery.load(), if you compare the return parameter value status with the string error, you can determine that the loading action resulted in an error. With this, as… 
- 
		6 votes2 answers1997 viewsA: How to detect Ajax Request?For those interested, the solution below follows the same line of reasoning as that presented by Harry Potter, however, it has better performance, in order to simply compare a value, without the… 
- 
		1 votes3 answers977 viewsA: How to make Divs with same height and 100% heightFrom the description and the images it seems to me that you intend to create a Dashboard. Not that it is not possible to be made from scratch, but there is no need to reinvent the wheel when there… 
- 
		3 votes2 answers2098 viewsA: Browse the entire DOM with jQueryBased in that comment you have at your disposal the methods of Traversing in particular jQuery.Parent() and jQuery.find(): $( '#element' ).click( function() { $( this ).parent().find( 'p' ); }); In… 
- 
		2 votes3 answers146 viewsA: Handle single while recordOne of the most painless ways to do this with your current code is to use a counter inside the while which you would use as a condition to apply some CSS class, for example. <?php $cursor = 0;… 
- 
		2 votes7 answers46159 viewsA: Remove repeated elements within a Javascript arrayI think it’s worth leaving one third alternative, part of the project PHPJS which aims to bring to the JS features present in PHP. In this case, a port of function array_unique(): function… javascriptanswered Bruno Augusto 8,661
- 
		1 votes1 answer82 viewsA: Percentages for files sent via formBased in that comment that best clarified the goal to be achieved, I leave as reference this other answer, also mine. Your problem seems to be more about mathematical logic than about the… phpanswered Bruno Augusto 8,661
- 
		0 votes1 answer324 viewsA: Return all results using preg_matchWhen syntactically parsing the HTML of a page with Regular Expressions, unfortunately being specific can be a problem. In such cases you should capture everything that is within a specific content… 
- 
		1 votes3 answers1785 viewsA: How to deal with multiple queries?Before executing multiple queries you need to analyze whether they are independent queries or not. Imagine, for example, an action log system that records all actions taken by a particular user. If… 
- 
		1 votes3 answers2200 viewsA: How to group mysql results by foreign keys in a single array through a single query?In response to that comment, in character off-topic, even if this is not the model of the Stack Overflow, but valid in my opinion, so that the brief doubts of a comment made more widely and fully.… 
- 
		0 votes2 answers8457 viewsA: Close PDO connectionDespite not having much relationship with original doubt, it is worth commenting. As you said you saw in a framework, almost absolute certainty (goes that...) that this was Object-Oriented and in… 
- 
		1 votes1 answer888 viewsA: What causes "Call to Undefined Function session_status()"?This answer has already been given in the form of commentary and, as suggested, I will be adding it as an answer too, in addition to better elaborate it, with links and formatting. session_status()… phpanswered Bruno Augusto 8,661
- 
		1 votes3 answers537 viewsA: Run script every 1000 queried recordsNone of the solutions presented meet the requirement to perform a certain routine also for records that do not reach a lot of 1000. With PHP it is not good to just separate presentation logic, PHP… phpanswered Bruno Augusto 8,661
- 
		0 votes1 answer1756 viewsA: Pass PHP value to Simplemodal Form via GETGiven the lack of important information, such as your current HTML, as well as a slightly more detailed description of what exactly you are trying to do, I will take on the two best scenarios I can… 
- 
		5 votes6 answers12772 viewsA: How to locate a value in an array with a specific structureI am surprised that many answers, including voted answers, point out as a solution a coded code, that filter the matrix to a single occurrence, manually coded in a mere conditional. Well... My… 
- 
		2 votes1 answer274 viewsA: how to pass an array with N arguments to a bind_param within a class?I won’t go into the merit of responsibility of objects because that is not the purpose of the question but what you have implemented does not make sense. Your class has none Setter, public method… phpanswered Bruno Augusto 8,661
- 
		3 votes2 answers2263 viewsA: Calculate total "cell" average in phpYou missed posting the most important part of your code which is the structure of the matrix but, even without it, I can give you a mathematical guidance on how to do. For table Heading of your… phpanswered Bruno Augusto 8,661
- 
		2 votes2 answers312 viewsA: PHP : Upload FileInitially I had not managed to reproduce its error, with its slightly adapted code. Here I got: Domdocument::load(): I/O Warning : failed to load External Entity Although it is a clear message from… 
- 
		2 votes5 answers7269 viewsA: Use if inside foreachAlthough with PHP you can do many things in many different ways it doesn’t mean you will hammer a bolt just because you haven’t found the right key. With that in mind, analyze what you want to do:… 
- 
		2 votes4 answers917 viewsA: How to check for value in a PHP array?Although much has been suggested to the use of isset() I suggest you prefer array_key_exists() instead. That’s because isset() with arrays besides checking if I determine the index exists will also… phpanswered Bruno Augusto 8,661
- 
		5 votes4 answers913 viewsA: Is multiple includes bad for performance?When doing a include/require you obviously intend to include/require a resource from another external file, whether(m) it(s) local(s) or remote(s). This file(s) is(are) stored(s) on a disk that, to… 
- 
		2 votes5 answers21918 viewsA: How to replace the <img src> of a small image with a large image?Most problems whose solution depends on navigating the DOM are solved by structuring the HTML properly. The structure presented by Kenny, used by many plugins like Lightbox, Colorbox among others,… 
- 
		2 votes8 answers64831 viewsA: How to check if a checkbox is checked with PHP?Work with checkbox with PHP is quite annoying because of this limitation of the program receiving the value only if it has been marked. But that limitation only becomes noticeably annoying when you… phpanswered Bruno Augusto 8,661
- 
		1 votes3 answers204 viewsA: Plugins or tools to create blog posts?An interesting alternative that runs away from the sameness of the WYSIWYG editors would be the Stackedit.io You create and save documents locally, in the browser, with live preview, HTML support,… 
- 
		5 votes4 answers6297 viewsA: Form inserting twice in the bank (F5)As a developer, you should always think of the worst possible scenario and always take into account the inexperience (to be nice) of users. You may have some JS that interrupts some repeat action of… 
- 
		6 votes4 answers4814 viewsA: Get value from external HTML TAG "<link>"In fact, the regular expression (since working with HTML should be done with DOM) more comprehensive and consequently more appropriate would be: /<link.*?href="(.*?)".*?>/i Since: Given the… 
- 
		2 votes7 answers3667 viewsA: PDO does not connect to MysqlIt is quite common to occur, especially with people who develop in Windows environment in versions prior to 5.3, version in which there is no need to enable a separate extension for the PDO itself,… 
- 
		3 votes1 answer880 viewsA: What is the best way to know if a URL is working?get_headers() is really the most appropriate for this case, however, in addition to your check being wrong (you reversed the argument from strpos()), i would do the different check: $headers =… phpanswered Bruno Augusto 8,661