LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 16 of 106
0 votes
2 ans
4 views
What is the difference between var_dump() and print_r() in terms of spitting out an array as string?

What is the difference between `var_dump()` and `print_r()` in terms of spitting out an array as string?

php-dev Solved
IN
asked 1 month ago by ina
0 votes
1 ans
3 views
How to get time difference in minutes in PHP

How to calculate minute difference between two date-times in PHP?

php-dev Solved
TO
asked 1 month ago by Tom Smykowski
0 votes
1 ans
3 views
Error “Target class controller does not exist” when using Laravel 8

**Here is my controller:** <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Reque...

php-dev Solved
NG
asked 1 month ago by Nguyễn Việt Dũng
0 votes
2 ans
4 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
2 ans
4 views
How to send a GET request from PHP?

I'm planning to use PHP for a simple requirement. I need to download a XML content from a URL, for which I need to send HTTP GET request to that URL. Ho...

php-dev Solved
VE
asked 1 month ago by Veera
0 votes
1 ans
3 views
Proper Repository Pattern Design in PHP?

*Preface: I'm attempting to use the repository pattern in an MVC architecture with relational databases.* I've recently started learning TDD in PHP,...

php-dev Solved
JO
asked 1 month ago by Jonathan
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
0 votes
1 ans
3 views
How to properly escape a double quote in CSV?

I have a line like this in my CSV: `"Samsung U600 24"","10000003409","1","10000003427"` Quote next to `24` is...

general-dev Solved
SR
asked 1 month ago by srgb
0 votes
1 ans
3 views
Insert string at specified position

Is there a PHP function that can do that? I'm using `strpos` to get the position of a substring and I want to insert a `string` after that position.

php-dev Solved
AL
asked 1 month ago by Alex
0 votes
2 ans
4 views
How to post data in PHP using file_get_contents?

I'm using PHP's function `file_get_contents()` to fetch contents of a URL and then I process headers through the variable `$http_response_header`. No...

php-dev Solved
PA
asked 1 month ago by Paras Chopra
0 votes
2 ans
4 views
PHP: How to send HTTP response code?

I have a PHP script that needs to make responses with HTTP response codes (status-codes), like HTTP 200 OK, or some 4XX or 5XX code. How can I do this in PHP...

php-dev Solved
PA
asked 1 month ago by Paulo Coghi
0 votes
2 ans
4 views
PHP7 : install ext-dom issue

I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install `cviebrock/eloquent-sluggable` package throw some error: pish@let:/home...

php-dev Solved
AL
asked 1 month ago by alex
0 votes
1 ans
3 views
Amazon S3 - How to fix 'The request signature we calculated does not match the signature' error?

I have searched on the web for over two days now, and probably have looked through most of the online documented scenarios and workarounds, but nothing worked f...

general-dev Solved
JO
asked 1 month ago by Joseph Lam
0 votes
2 ans
3 views
PHP "php://input" vs $_POST

I have been directed to use the method `php://input` instead of `$_POST` when interacting with Ajax requests from JQuery. What I do not understand is the benefi...

php-dev Solved
LE
asked 1 month ago by Lee
0 votes
1 ans
3 views
Best way to initialize an (empty) array in PHP

In certain other languages ([ActionScript 3][1] for example), it has been noted that initializing a new array is faster if done like this `var foo = []` rather...

php-dev Solved
TO
asked 1 month ago by Tom Auger
0 votes
1 ans
3 views
Explode PHP string by new line

Simple, right? Well, this isn't working :-\ $skuList = explode('\n\r', $_POST['skuList']);

php-dev Solved
BE
asked 1 month ago by Ben
0 votes
1 ans
3 views
PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I&#3...

php-dev Solved
AN
asked 1 month ago by anomareh
0 votes
1 ans
3 views
When should I use Memcache instead of Memcached?

It seems that PHP has two memcached libraries named [memcache][1] and [memcached][2]. What is the difference and how do you know which one to use? Is one outdat...

general-dev Solved
XE
asked 1 month ago by Xeoncross
0 votes
2 ans
4 views
What does yield mean in PHP?

I've recently stumbled over this code: function xrange($min, $max) { for ($i = $min; $i <= $max; $i++) { yield $i;...

php-dev Solved
GO
asked 1 month ago by Gordon
0 votes
2 ans
5 views
How to order a Laravel query builder result by multiple columns?

I want to sort multiple columns in Laravel 4 by using the method `orderBy()` in Laravel Eloquent. The query will be generated using Eloquent like this: S...

database Solved
SO
asked 1 month ago by Sophy