378 solutions found in general-dev
Page 3 of 19votes
I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the use...
votes
How do I turn on all error and warnings and log them to a file, but to set up all of that within the script (not changing anything in php.ini)? I want to def...
votes
Is there any particular difference between intval and (int)? Example: $product_id = intval($_GET['pid']); $product_id = (int) $_GET['...
votes
What are PHP Namespaces? What are Namespaces in general? A Layman answer with an example would be great.
votes
I would like to know the difference between `require` and `require-dev`. The composer website doesn't offer a good explanation the difference between thes...
votes
I have this PHP code: function ShowFileExtension($filepath) { preg_match('/[^?]*/', $filepath, $matches); $string = $match...
votes
Recently I've read about namespaces and how they are beneficial. I'm currently creating a project in Laravel and trying to move from class map autoloadi...
votes
I want to get visitors country via their IP... Right now I'm using this (http://api.hostip.info/country.php?ip=...... ) Here is my code: <?php...
votes
I have searched high and low and get a lot of different solutions and variables containing info to get the absolute path. But they seem to work under some cond...
votes
I'm trying to make a simple example in order to learn how to delete a row from a parent table and automatically delete the matching rows in the child table...
votes
I have always used `||` (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: `|`. What is the difference between those two...
votes
I have a simple [text area][1] in a form like this: <textarea style="width:350px; height:80px;" cols="42" rows="5" name=...
votes
How can I convert an image from a URL to Base64 encoding?
votes
I'm looking for a list of all locales and their short codes for a PHP application I am writing. Is there much variation in this data between platforms? A...
votes
I have a foreach loop and an if statement. If a match is found I need to ultimately break out of that foreach and if. foreach($equipxml as $equip) {...
votes
I want to know how many milliseconds a PHP *for* loop takes to execute. I know the structure of a generic algorithm: ```lang-none Begin init1 = timer();...
votes
Is `ob_start()` used for `output buffering` so that the headers are buffered and not sent to the browser? Am I making sense here? If not then why should we use...
votes
I have a codebase where developers decided to use `AND` and `OR` instead of `&&` and `||`. I know that there is a difference in operators' preced...
votes
Our (PHP) framework sometimes renders hidden inputs with value `YTowOnt9`. I can't find that string anywhere in the (huge) codebase, and can't figure ou...
votes
I'd like a cleaner way to obtain the following functionality, to catch `AError` and `BError` in one block: try { /* something */ }...