Questions tagged [php]
Questions about PHP, a widely-used general-purpose scripting language that is especially suited for Web development.
5 questions from the last 365 days
2
votes
2
answers
151
views
How to namespace global function overrides?
In PHP, trim() exists.
By default the second parameter is " \n\r\t\v\x00"
I wish to introduce my own version which doesn't deviate far from the core functionality:
// Trim whitespace in ...
3
votes
3
answers
236
views
Best Practices for Implementing a Heartbeat Feature in a Laravel App to Track Offline Status
I'm trying to implement a heartbeat feature for offline tracking that just sends an offline message to the server once the web browser app (Laravel-based) is offline. Ideally it will ping the app's ...
3
votes
1
answer
194
views
How should User behaviour depending on role be design as OOP
Imagine I got user which might be either author, administrator, reviewer
An author have relation on book that he wrote.
An administrator have relation on banned user (we track which administrator ...
1
vote
1
answer
153
views
Best practice for integrating UI and dynamic user-specific content using a Flask app
I am building a website that uses a recommendation system. Users submit a form which is sent to the backend for the recommendation logic calculation; the recommendation response is sent back to the ...
2
votes
1
answer
200
views
Is widening parameter types in a PHP interface implementation a good practice?
I have an interface defined as follows:
interface MyInterface
{
public function setMyMethod(int $a);
public function getMyMethod(): int;
}
And I have a class that widens the parameter type:
...