The command-line tool is, of course, a good thing - but a graphical environment is even better. This is about a MySQL design environment, or GUI. Exactly what's needed: convenient editing, saving queries, creating connections and synchronising data/structure. And of course - backups. I have to say, this is one of the most successful applications for MySQL that I've come across recently.
When creating a design, layout or sample where there is no real text or visual material yet, the question arises - what to put in? Variations on this theme abound. Some write xxx, some paste an article from a news site, some scrape text from who knows where. But it turns out this problem has been solved. It's called Lorem Ipsum.
Another OOP trick. Though this time not about functionality, but about visual style. So - method chaining, also known as class methods chaining or ganging. For example: echo $thisDog->owner()->name();
An interface in PHP could be thought of as a very abstract object that defines mandatory procedures without specifying what those procedures should do. The characteristic of an interface is that if a procedure is defined, it must be implemented in the class. Interfaces can be combined - i.e. multiple interfaces can be specified - and can even be extended.
In the previous article I compiled, from my perspective, the most classic myths and truths about the performance of PHP functions and language constructs that I have heard or seen so far. This article will cover several examples with constructs where the performance (or lack thereof) is not always obvious. For example, did you know that incrementing a local variable inside a function will be ~2x faster than a global one?
Performance, code readability, code logic and similar are the cornerstones between which one must constantly navigate when building a larger or smaller PHP project. I'll start by saying that any measurement is relative and depends greatly on both the environment and the PHP version.
It has been observed that require_once is up to 4 times slower than require. Various figures and measurements can be found on Google, sometimes contradictory. Including a file multiple times is inherently not good, as the file is read and the code within it is parsed and executed.
If ready-made solutions (e.g. WordPress), where there is a risk that forum spambots could participate in filling out forms (discussion, registration, etc.), have provisions for this built in - then in solutions built from scratch, this kind of protection must be thought through by the developer.
Situation description: Two tables: agent and operations. The operations table has a foreign key defined on the agentID field pointing to the agent table. Problem: A default value needs to be created for the agentID field.
This time my interest fell specifically on user-defined variables. They can be broadly divided into two categories: declared variables, used in procedures and functions, and undeclared variables, also used in procedures and functions, but which can be used in an SQL query "in-line".