LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

378 solutions found in general-dev

Page 3 of 19
0 votes
1 ans
3 views
How to execute a background process?

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...

general-dev Solved
TI
asked 1 month ago by tim
0 votes
1 ans
3 views
How do I log errors and warnings into a file?

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...

general-dev Solved
GO
asked 1 month ago by Gorep
0 votes
1 ans
3 views
Is there any particular difference between intval and casting to int - `(int) X`?

Is there any particular difference between intval and (int)? Example: $product_id = intval($_GET['pid']); $product_id = (int) $_GET['...

general-dev Solved
SA
asked 1 month ago by Sarfraz
0 votes
1 ans
3 views
What are namespaces?

What are PHP Namespaces? What are Namespaces in general? A Layman answer with an example would be great.

general-dev Solved
IM
asked 1 month ago by Imran
0 votes
1 ans
3 views
What's the difference between require and require-dev?

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...

general-dev Solved
SL
asked 1 month ago by slier
0 votes
1 ans
3 views
How to get file name without file extension?

I have this PHP code: function ShowFileExtension($filepath) { preg_match('/[^?]*/', $filepath, $matches); $string = $match...

general-dev Solved
MO
asked 1 month ago by Mostafa Elkady
0 votes
1 ans
3 views
What Are the Differences Between PSR-0 and PSR-4?

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...

general-dev Solved
VA
asked 1 month ago by Varun Nath
0 votes
1 ans
3 views
Getting visitors country from their IP

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...

general-dev Solved
AL
asked 1 month ago by Alex C.
0 votes
1 ans
3 views
Get absolute path of initially run script

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...

general-dev Solved
IN
asked 1 month ago by inquam
0 votes
1 ans
3 views
On delete cascade with doctrine2

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...

general-dev Solved
RF
asked 1 month ago by rfc1484
0 votes
1 ans
3 views
What is the difference between the | and || or operators?

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...

general-dev Solved
GL
asked 1 month ago by GloryFish
0 votes
1 ans
3 views
Why is textarea filled with mysterious white spaces?

I have a simple [text area][1] in a form like this: <textarea style="width:350px; height:80px;" cols="42" rows="5" name=...

general-dev Solved
AF
asked 1 month ago by Afamee
0 votes
1 ans
3 views
How to convert an image to Base64 encoding

How can I convert an image from a URL to Base64 encoding?

general-dev Solved
VO
asked 1 month ago by Volatil3
0 votes
1 ans
3 views
List of All Locales and Their Short Codes?

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...

general-dev Solved
KI
asked 1 month ago by Kirk Ouimet
0 votes
1 ans
3 views
break out of if and foreach

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) {...

general-dev Solved
AU
asked 1 month ago by au_stan
0 votes
1 ans
3 views
Accurate way to measure execution times of scripts

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();...

general-dev Solved
DO
asked 1 month ago by DomingoSL
0 votes
1 ans
3 views
What's the use of ob_start()?

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...

general-dev Solved
AD
asked 1 month ago by Aditya Shukla
0 votes
1 ans
3 views
'AND' vs '&&' as operator

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...

general-dev Solved
TS
asked 1 month ago by ts.
0 votes
1 ans
3 views
What is 'YTowOnt9'?

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...

general-dev Solved
SH
asked 1 month ago by Sherlock
0 votes
1 ans
3 views
Catching multiple exception types in one catch block

I'd like a cleaner way to obtain the following functionality, to catch `AError` and `BError` in one block: try { /* something */ }...

general-dev Solved
DO
asked 1 month ago by Dominic Gurto