LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

378 solutions found in general-dev

Page 5 of 19
0 votes
1 ans
3 views
How to remove non-alphanumeric characters?

I need to remove all characters from a string which aren't in `a-z A-Z 0-9` set or are not spaces. Does anyone have a function to do this?

general-dev Solved
ZU
asked 1 month ago by zuk1
0 votes
1 ans
3 views
Why would one omit the close tag?

I keep reading it is poor practice to use the PHP close tag `?>` at the end of the file. The header problem seems irrelevant in the following context (and th...

general-dev Solved
JO
asked 1 month ago by johnlemon
0 votes
1 ans
3 views
How do I check if a directory exists? "is_dir", "file_exists" or both?

I want to create a directory if it does not exist already. Is using the `is_dir` function enough for that purpose? if ( !is_dir( $dir ) ) { m...

general-dev Solved
PE
asked 1 month ago by Peter
0 votes
1 ans
3 views
Default value in Doctrine

How do I set a default value in Doctrine 2?

general-dev Solved
JI
asked 1 month ago by Jiew Meng
0 votes
1 ans
3 views
Invalid argument supplied for foreach()

It often happens to me to handle data that can be either an array or a null variable and to feed some `foreach` with these data. $values = get_values();...

general-dev Solved
RO
asked 1 month ago by Roberto Aloi
0 votes
1 ans
3 views
Traits vs. interfaces

I've been trying to study up on PHP lately, and I find myself getting hung up on traits. I understand the concept of horizontal code reuse and not wanting t...

general-dev Solved
DA
asked 1 month ago by datguywhowanders
0 votes
1 ans
3 views
Convert seconds to Hour:Minute:Second

I need to convert seconds to "Hour:Minute:Second". For example: "685" converted to "00:11:25" How can I achieve this?

general-dev Solved
EZ
asked 1 month ago by EzzDev
0 votes
1 ans
3 views
Correct file permissions for WordPress

I've had a look over [here][1] but didn't find any details on the best file permissions. I also took a look at some of WordPress's form's quest...

general-dev Solved
JO
asked 1 month ago by John Crawford
0 votes
1 ans
3 views
Could not open input file: artisan

When trying to create a new laravel project, The following error appears on the CLI: > Could not open input file: artisan > > Script php artisan clea...

general-dev Solved
WE
asked 1 month ago by wessodesigner
0 votes
1 ans
3 views
Check whether a request is GET or POST

> **Possible Duplicate:** > [PHP detecting request type (GET, POST, PUT or DELETE)](https://stackoverflow.com/questions/359047/php-detecting-request-typ...

general-dev Solved
GR
asked 1 month ago by Graviton
0 votes
1 ans
3 views
How should I choose an authentication library for CodeIgniter?

I see there are [a few][1]. Which ones are maintained and easy to use? What are their pros and cons? [1]: http://codeigniter.com/wiki/Category:Libraries...

general-dev Solved
GA
asked 1 month ago by GavinR
0 votes
1 ans
3 views
"date(): It is not safe to rely on the system's timezone settings..."

I got this error when I requested to update the [PHP][1] version from 5.2.17 to PHP 5.3.21 on the server. <div style="border:1px solid #990000;paddi...

general-dev Solved
US
asked 1 month ago by user1852837
0 votes
1 ans
3 views
Finding the number of days between two dates

How to find number of days between two dates using PHP?

general-dev Solved
PH
asked 1 month ago by PHP Ferrari
0 votes
1 ans
3 views
Show a number to two decimal places

What's the correct way to round a PHP string to two decimal places? $number = "520"; // It's a string from a database $formatted...

general-dev Solved
RI
asked 1 month ago by Rich Bradshaw
0 votes
1 ans
3 views
Create a folder if it doesn't already exist

I've run into a few cases with WordPress installs with [Bluehost][1] where I've encountered errors with my WordPress theme because the uploads folder `w...

general-dev Solved
SC
asked 1 month ago by Scott B
0 votes
1 ans
3 views
How to read a large file line by line?

I want to read a file line by line, but without completely loading it in memory. My file is too large to open in memory, and if try to do so I always get out...

general-dev Solved
AD
asked 1 month ago by adnan masood
0 votes
1 ans
3 views
htmlentities() vs. htmlspecialchars()

What are the differences between `htmlspecialchars()` and `htmlentities()`. When should I use one or the other?

general-dev Solved
ER
asked 1 month ago by Eric Hogue
0 votes
1 ans
3 views
Change the maximum upload file size

I have a website hosted on a PC I have no access to. I have an upload form allowing people to upload mp3 files up to 30MB big. My server side script is done in...

general-dev Solved
YO
asked 1 month ago by Yo Momma
0 votes
1 ans
3 views
New self vs. new static

I am converting a PHP 5.3 library to work on PHP 5.2. The main thing standing in my way is the use of late static binding like `return new static($options);` ,...

general-dev Solved
MI
asked 1 month ago by Mike
0 votes
1 ans
3 views
Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted

I have a bunch of client point of sale (POS) systems that periodically send new sales data to one centralized database, which stores the data into one big datab...

general-dev Solved
AR
asked 1 month ago by ArcticZero