LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

378 solutions found in general-dev

Page 4 of 19
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
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
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
1 ans
3 views
Detect encoding and make everything UTF-8

I'm reading out lots of texts from various RSS feeds and inserting them into my database. Of course, there are several different character encodings used...

general-dev Solved
CA
asked 1 month ago by caw
0 votes
1 ans
3 views
Only variables should be passed by reference

// Other variables $MAX_FILENAME_LENGTH = 260; $file_name = $_FILES[$upload_name]['name']; //echo "testing-".$file_name.&qu...

general-dev Solved
FR
asked 1 month ago by Frank Nwoko
0 votes
1 ans
3 views
Delete directory with files in it?

I wonder, what's the easiest way to delete a directory with all its files in it? I'm using `rmdir(PATH . '/' . $value);` to delete a folder,...

general-dev Solved
MA
asked 1 month ago by matt
0 votes
1 ans
3 views
How to check for null in Twig?

What construct should I use to check whether a value is NULL in a Twig template?

general-dev Solved
FL
asked 1 month ago by Fluffy
0 votes
2 ans
3 views
How should a model be structured in MVC?

I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like...

general-dev Solved
DI
asked 1 month ago by Dietpixel
0 votes
1 ans
3 views
How to find the last day of the month from date?

How can I get the last day of the month in PHP? Given: $a_date = "2009-11-23" I want 2009-11-30; and given $a_date = "2009-12...

general-dev Solved
MI
asked 1 month ago by Mithun Sreedharan
0 votes
1 ans
3 views
How to create a newline character?

In PHP I am trying to create a newline character: echo $clientid; echo ' '; echo $lastname; echo ' '; echo '\r\n&...

general-dev Solved
DA
asked 1 month ago by davidjhp
0 votes
1 ans
3 views
Fatal error: Maximum execution time of 30 seconds exceeded

I am downloading a JSON file from an online source and and when it runs through the loop I am getting this error: > Fatal error: Maximum execution time of...

general-dev Solved
HA
asked 1 month ago by Harsha M V
0 votes
1 ans
3 views
Showing all errors and warnings

**UPDATE 2:** I have now removed the following from the .php file: <?php error_reporting( E_ALL ); ?> I have set display_erros in php.ini as...

general-dev Solved
OS
asked 1 month ago by oshirowanen
0 votes
1 ans
3 views
Can't use method return value in write context

I would think the following piece of code should work, but it doesn't **(Edited: Now works in PHP 5.5+)**: if (!empty($r->getError())) Where `g...

general-dev Solved
EX
asked 1 month ago by Extrakun
0 votes
1 ans
3 views
No Application Encryption Key Has Been Specified

I'm trying to use the `Artisan` command like this: php artisan serve It displays: > Laravel development server started: <http://127.0.0.1...

general-dev Solved
CA
asked 1 month ago by Carlos F
0 votes
1 ans
3 views
What is the difference between bindParam and bindValue?

What is the difference between [`PDOStatement::bindParam()`][1] and [`PDOStatement::bindValue()`][2]? [1]: http://www.php.net/manual/en/pdostatement.bind...

general-dev Solved
KO
asked 1 month ago by koen
0 votes
1 ans
3 views
Displaying HTML with Blade shows the HTML code

I have a string returned to one of my views, like this: $text = '<p><strong>Lorem</strong> ipsum dolor <img src="images/tes...

general-dev Solved
LE
asked 1 month ago by lesssugar
0 votes
1 ans
3 views
Why doesn't this code simply print letters A to Z?

<?php for ($i = 'a'; $i <= 'z'; $i++) echo "$i\n"; This snippet gives the following output (newlines are re...

general-dev Solved
MI
asked 1 month ago by Milan Babuškov
0 votes
1 ans
3 views
Can I try/catch a warning?

I need to catch some warnings being thrown from some php native functions and then handle them. Specifically: array dns_get_record ( string $hostname...

general-dev Solved
US
asked 1 month ago by user121196
0 votes
1 ans
3 views
urlencode vs rawurlencode?

If I want to create a URL using a variable I have two choices to encode the string. `urlencode()` and `rawurlencode()`. What exactly are the differences and...

general-dev Solved
GA
asked 1 month ago by Gary Willoughby
0 votes
1 ans
3 views
Using str_replace so that it only acts on the first match?

I want a version of `str_replace()` that only replaces the first occurrence of `$search` in the `$subject`. Is there an easy solution to this, or do I need a ha...

general-dev Solved
NI
asked 1 month ago by Nick Heiner