LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 22 of 106
0 votes
1 ans
3 views
PHP shell_exec() vs exec()

I'm struggling to understand the difference between `shell_exec()` and `exec()`... I've always used `exec()` to execute server side commands, when wo...

php-dev Solved
BE
asked 1 month ago by Ben
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
Send email using the GMail SMTP server from a PHP page

I am trying to send an email via GMail's SMTP server from a PHP page, but I get this error: > authentication failure [SMTP: SMTP server does no suppor...

server-admin Solved
SK
asked 1 month ago by skb
0 votes
1 ans
3 views
Pass a PHP variable to a JavaScript variable

What is the easiest way to encode a PHP string for output to a JavaScript variable? I have a PHP string which includes quotes and newlines. I need the conte...

php-dev Solved
DA
asked 1 month ago by David Laing
0 votes
1 ans
3 views
Extract a single (unsigned) integer from a string

I want to extract the digits from a string that contains numbers and letters like: "In My Cart : 11 items" I want to extract the number `11`...

php-dev Solved
DA
asked 1 month ago by Dali
0 votes
1 ans
3 views
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

I have recently installed Laravel 5 via Composer. I tried creating a new controller using Artisan and got the following error. Am I missing something? >bo...

php-dev Solved
SC
asked 1 month ago by Scott
0 votes
1 ans
3 views
How do you debug PHP scripts?

How do you debug **PHP** scripts? I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in **PHPEclipse** is also quite u...

php-dev Solved
MA
asked 1 month ago by Marcel
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
?: operator (the 'Elvis operator') in PHP

I saw this today in some PHP code: $items = $items ?: $this->_handle->result('next', $this->_result, $this); I'm not familiar wit...

php-dev Solved
AL
asked 1 month ago by alpha_juno
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
php create object without class

In JavaScript, you can easiliy create an object without a class by: myObj = {}; myObj.abc = "aaaa"; For PHP I've found this one,...

php-dev Solved
WO
asked 1 month ago by Wolfgang Adamec
0 votes
1 ans
3 views
How can I remove three characters at the end of a string in PHP?

How can I remove three characters at the end of a string in PHP? "abcabcabc" would become "abcabc"!

php-dev Solved
US
asked 1 month ago by user502039
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
PHP append one array to another (not array_push or +)

How to append one array to another without comparing their keys? $a = array( 'a', 'b' ); $b = array( 'c', 'd' ); At...

php-dev Solved
DA
asked 1 month ago by Danil K
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
How to convert date to timestamp in PHP?

How do I get timestamp from e.g. `22-09-2008`?

php-dev Solved
WI
asked 1 month ago by Wizard4U
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
PHP - Check if two arrays are equal

I'd like to check if two arrays are equal. I mean: same size, same index, same values. How can I do that? Using `!==` as suggested by a user, I expect th...

php-dev Solved
MA
asked 1 month ago by markzzz