Yes you should make 2 tables for book entities. As you have different types of records to be inserted in the table. In one table you only have books which have series or multiple editions while other table has those books which have only single edition. It will become quite easy at the time of fetching the data.
there are limitations on using HTML within PHP.
Most of the time you would have your HTML outside. You would create a page just as you would if you were not using PHP, then add the PHP into the areas of the document where you need it. You can have several chunks of PHP within a document.
Working With PHP Inside HTML has some examples :
Can both programs run from the same node?
Are the programs happy with sharing their node?
What level of service are you trying to establish?
Is there enough compute resources on that single droplet to maintain both programs, especially during peak load?
Is there an overriding concern such as security, reliability, or a business/country policy/regulation ...
PHP source is hosted on GitHub, and GitHub has an API. Therefore, you can:
Access the API in order to get the list of last revisions,
Filter the ones you don't want (for instance the ones containing “alpha” or “RC” in the names).
Parse the remaining revisions and sort the list (if you don't sort it, you'll get the revisions in the order when they were ...
Jay's answer is correct that you can do this thing.
The normal way to describe this is that you'll be developing the python algorithm (function) into a "service" (standalone application) that your PHP app will "consume" (make calls to). This is a fine idea if the algorithm is complex enough that you want to think of it as its own program; sequestering your ...
The reason to avoid using new, is to create a seam, which allows you to 'unstitch' the program and change its behaviour without editing that part of the code.
So to decide whether to avoid using 'new', you need to think about whether you're likely to want to run the code you're writing in multiple different ways, either for different types of use, or for ...
Regarding the update: Without knowing more about the system I can only guess, but if the class is actually used in the exact way you've described in the question, then, on the surface, it does look like bad or superfluous design, as there doesn't seem to be a specific reason for it.
The more generic answer below was based on the original question ...
There is a procedural design, and there is event driven design when it comes to designing a solution to the business problem. Design should always ignore implementation (like PHP, or CSV file format). I would classify the previous answers as procedural, so what would event driven look like?
What is the business event that must have a business output? Is ...
It would not need a lot of if else statements:
Read the birthdays csv,
create sorted array of birthdays
for each birthday
calculate the next business day and add to array
go through sorted array and apply the rules:
1. If there are to presents two days in a row, we instead provide one large present on the second day.
2. The day after each day a present ...
You can impose validation in every layer of your application. Where to impose which rules depend on your application.
For example, entities implement methods that represent business rules while use-cases implement rules specific to your application.
If your building an e-mailservice like Gmail one could argue that the rule "users should have a unique e-...
As of PHP 7.4, the playing field changes a bit:
<? ?> is officially deprecated and will be removed in PHP 8.0.
PHP RFC: Deprecate PHP Short open tags explicitly states that <?= ?> is unaffected. This would indicate (according to me, not the RFC) that its usage is not discouraged.