Posts by chambelix • 2,451 points
75 posts
-
1
votes4
answers1072
viewsA: What is the practical use of bitwise operators in PHP?
Here is an interesting question, but I totally disagree with the statement of your question where you mention: ... in compiled languages such as C/C++, it is easier to understand due to the higher…
-
1
votes0
answers19
viewsQ: Composer new config.Platform parameter
In the last Composer update alpha11 a new parameter for configurations independent of the platform version was introduced with the config.platform which is genius. I find little or no documentation.…
-
3
votes1
answer1182
viewsA: PHP Mailer Does Not Work Localhost
The Phpmailer you need to define if it is to verify the certificate or not. I understand that you do not have any by the code you present and by being in localhost, so I suggest that in its…
-
2
votes2
answers243
viewsA: Is it safe to use $_SERVER variables to log errors?
The answer to your question can be found in the PHP manual itself specifically at: $_SERVER I highlight the paragraph: $_SERVER is an array containing information such as headers, paths, and script…
-
-1
votes1
answer376
viewsA: How to block login on 2 devices?
Considering that the information that is not enough to understand what is already done as mentioned and if asked to develop a system within what described my option was clearly by using tokens JWT.…
-
2
votes1
answer62
viewsA: Is it a good idea to use interfaces to specify which magic methods a class will implement?
Although both in many cases may seem to serve "almost" for the same effect in fact the instanceof seeks to inform whether a particular class implements a particular interface, which is not the same…
-
3
votes2
answers1399
viewsA: How to keep page updated without refresh?
Your page update is not bad, the problem is on the server side. Of course it can be improved, but the principle is what you use. The call of Ajax is well done and serves the purpose. On the server…
-
2
votes3
answers767
viewsA: Netbeans IDE: Warning Message
Nothing to really worry about. Only a message the IDE generates from a setting that can parameterize into number of rows. The idea behind this type of control has to do with some good development…
-
5
votes2
answers1905
viewsA: How do I get the browser user’s language?
Your question does not make much sense to me the way you put it. I understand the problem you have at hand but you have already thought that today the Internet is mobility? What happens if your user…
-
1
votes3
answers580
viewsA: How to keep a web project in sync with a remote server?
Nowadays there are many solutions that allow us to respond to project synchronization remotely and online. As a professional I am obliged to do it in various ways. At this moment one of the projects…
-
8
votes1
answer147
viewsQ: Should license comments on CSS or Javascript files be maintained or not?
This question arises when I finalize a mechanism to realize a Bundle of CSS and JS files with consequent cache. In many projects we all use mechanisms that allow reducing the size of CSS and JS…
-
1
votes1
answer262
viewsA: Advantages and disadvantages of using INI files
INI Archives are considered a standard. An "informal standard" for configuration files for software. INI Archives are simple text files, with a basic structure composed of sections, properties and…
-
1
votes1
answer84
views -
4
votes2
answers161
viewsA: How to turn a hash into a color
By directly answering the question the way to turn a hash into a color will be: function hashToColor($hash) { $code = dechex(crc32($hash)); $code = substr($code, 0, 6); return $code; } Obviously the…
-
8
votes3
answers4009
viewsA: Why is it important to remove X-Powered-by from response headers? How to remove?
See this article already old and still very useful: Apache Tips & Tricks: Hide PHP Version (X-Powered-By) I would also like to add that in the systems I develop or participate this header…
-
1
votes1
answer325
viewsA: Privacy policy and cookie blocking in the browser
The COOKIE is an interesting mechanism but as mentioned can be blocked by the browser. This is a feature and can do nothing to change. In order to maintain navigation data Sessões is the…
-
2
votes1
answer65
viewsA: At which points does Arrayaccess not resemble the native PHP array?
In direct answer to the question... One of the great limitations of this interface that gives so much way, is in relation to multi-dimensional arrays. That is, its implementation cannot be direct.…
-
1
votes1
answer38
viewsA: Mysql database access design
When analysing its implementation, I see nothing wrong. As for its adaptability in several cases I understand what it tries to do having a base configuration array. It is common to notice in…
-
9
votes2
answers4104
viewsA: When should I use Inheritance, Abstract Class, Interface, or a Trait?
I’m not going to go in for documentation because every case is more than documented, I’m just going to try to pass on my experience in my answer. Use depends on implementation and what you want to…
-
1
votes2
answers68
viewsA: How to check if a class is using a Trait?
There is a function in PHP that is class_uses. Check the link class_uses
-
2
votes5
answers169
viewsA: What is the fastest is_null($y) or $y == null?
Your question is tricky because the result is never the same for: is_null($y) ou $y == null to compare you should do so on: is_null($y) ou $y === null Here yes the results will be similar. It is…
-
2
votes2
answers767
viewsA: How to create a subdirectory tree with an Array
Here you go: function toArray($path) { $array = [$path]; do { $path = pathinfo($path)['dirname']; $array [] = $path; } while (strlen(basename($path)) > 1); return $array; }…
-
1
votes2
answers1007
viewsA: Multi-language system
Your question is relevant and the same, for me, is more about form and not about how. I asked a question that I recommend reading: MVC and dynamic language change I can tell from experience that we…
-
2
votes2
answers70
viewsA: Problems with Json
I read @rray’s previous answer and although certain in JSON manipulation, I don’t think it answers the question in full. The best answer and according to the question: read from a "text file…
-
1
votes2
answers915
viewsA: How to set the startup file in an HTML project?
In Netbeans IDE 8. In the project tab where your project is listed, choose the project in question. Then: With the mouse pointer on top of the project press the right mouse button From the menu that…
-
4
votes2
answers1296
viewsA: Open ID Connect and Oauth 2
The OpenID does not extend the OAuth he uses the OAuth as a basis becoming a layer about Oauth. Oauth is pure delegation without any notion of identity. Having said that, I simplify the application…
-
1
votes3
answers369
viewsQ: MVC and dynamic language change
I have a MVC that I implement in my projects in PHP. This supports multiple languages and by default gets the active/initial language from the browser. However there are projects that require the…
-
2
votes1
answer97
viewsA: Decrease responsibility of a class
As far as the class is concerned, I do not see any problem, and I do not understand the responsibility described in the question. The best answer can only be given after the project will be…
-
3
votes1
answer579
viewsA: Using Webservice + Sqlite
In the wikipédia as regards a WEBSERVICE can be read: Web service is a solution used in the integration of systems and communication between different applications. Since in your case the…
-
1
votes1
answer520
views -
1
votes2
answers757
viewsA: MVC PHP - Libraries - Directory Structure
My answer goes in the sense of my experience in MVC and specifically in PHP as put in the question and as regards its structure. Without going into basic concepts, the experience has led me over the…
-
4
votes1
answer210
viewsA: Netbeans Project with git and Composer repository
I have been walking and as I mentioned in the question to develop three projects, where one I named the MAIN project depends on two other bases/components. As the development is simultaneously…
-
1
votes1
answer967
viewsA: Doubt in web service development for APP(android) and WEB(php)
I think the best way to help is to define what types of webservices you can find these days "the most common". I define two situations although one is actually a protocol: Webservice SOAP - Simple…
-
4
votes2
answers11707
viewsA: How, when and where to use PHP’s magic methods? Get and Set? What’s the difference? Should I use them in every class I create?
This question is part of the subject of: PHP Using Magical or Not Methods? However, my reply is due to the context of the part where it mentions: I must use them in every class I create? The answer…
-
9
votes1
answer210
viewsQ: Netbeans Project with git and Composer repository
I am developing a PHP project that requires two libraries separately. I am required to use NETBEANS. To develop the three separately but at the same time and because the main project "MAIN PROJECT"…
-
3
votes3
answers154
viewsA: Optimization of PHP functions for database querys
There is no problem in what indicates, the implementation depends a lot on each one being that results in a call at the end within the rules of PDO. Of course, it also depends a lot on the project,…
-
1
votes1
answer66
viewsA: How to fetch a file from an internal server?
In this particular case I would perhaps use existing solutions such as Owncloud. It has a feature called External Storage support and with it you can reference files hosted at other points such as:…
-
1
votes2
answers588
viewsA: Doubt about the MOD operator in PHP
No PHP the operator % refers to: $a % $b Módulo Resto de $a dividido por $b. where the module operands are converted to integers (removing the decimal part) before processing... to which I still…
-
7
votes2
answers791
viewsA: What are the advantages and disadvantages of declaring constants as an array?
Truth since version 5.6 of PHP is possible constants as array. From my point of view and from the experience I have I would say that it is another useful feature that comes according to the approach…
-
1
votes2
answers706
viewsA: How to send array files via ajax?
I do not know if I understood very well if you want AJAX for PHP or the reverse and so I put both: 1-To send from JAVASCRIPT you must turn the array into a json string: $.ajax({ url:…
-
1
votes3
answers3387
viewsA: Unlock field when selecting Chekbox
If I understand what you want is to enable or disable a set of grouped elements and want to use a checkbox to do so... then you have this form in JQUERY I prepared for you. Put a container that in…
-
2
votes4
answers172
viewsA: Rewriting vs Incremental Improvement?
As I understand your question. If the system is from 2008 it means it was developed with the reality of 2006 forward. More or less. A lot has changed, many basic PHP functions are and have been…
-
4
votes3
answers3002
viewsA: Dynamic search in real time
The answer is YES... you can get real-time response when a user types something, however some are the points to take into account. In the case of using JQUERY and PHP as requested, request by AJAX…
-
1
votes1
answer224
viewsA: Keep connection open in php webservice
Pertinent question. Part of the answer is in this my answer in the following link here in the OS... Multiple connections with the Bank I would add that its implementation contemplates and very well…
-
0
votes2
answers121
viewsA: Which of these three codes is the most recommended in memory and speed?
Your question is very interesting. Php like any programming language requires optimization in the development cycle in any project. As far as the question raised and in my opinion your last option…
-
4
votes2
answers3250
viewsA: How can I purchase HTTPS in my web application?
First of all you cannot purchase the HTTPS. If you read the answer from @mgibsonbr in the question referred to it explains and poses the question as it is. If you visit the Wiki you will read that:…
-
6
votes2
answers357
viewsQ: Base62 coding
I wonder where I can get some PHP implementation, similar to MIME Base64 PHP but only with A-Z, a-z and 0-9 characters. The Base64 from PHP is quite versatile, but I need an algorithm that doesn’t…
-
3
votes1
answer1467
views -
2
votes2
answers698
viewsA: How to encode a number in PHP
The use of a coded value and according to what I understood in your question, may well be a BITFIELD. If you search for your definition in the WIKI you will find: A bit field is a term used in…
-
5
votes3
answers1629
viewsA: Multiple connections with the Bank
Says the PHP manual that ... The connection to the server will be closed as soon as the execution of the script terminate, unless it has previously been closed using explicitly... True, but not…