LMSouq

Knowledge Base

Browse Moodle Solutions

2110 solutions found

Page 22 of 106
0 votes
3 ans
28 views
How to get body of a JSON POST in PHP?

I submit as POST to a PHP page the following data: ```json {a:1} ``` In my PHP code, what do I have to do to extract that value? ```php var_dump($_PO...

php-dev Solved
IT
asked 5 months ago by Itay Moav -Malimovka
0 votes
3 ans
26 views
Best way to do multiple constructors in PHP

You can't put two __construct functions with unique argument signatures in a PHP class. I'd like to do this: class Student { protec...

php-dev Solved
JA
asked 5 months ago by Jannie Theunissen
0 votes
2 ans
29 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 5 months ago by Ben
0 votes
2 ans
35 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 5 months ago by Roberto Aloi
0 votes
2 ans
36 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 5 months ago by skb
0 votes
2 ans
28 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 5 months ago by David Laing
0 votes
3 ans
30 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 5 months ago by Dali
0 votes
2 ans
27 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 5 months ago by Scott
0 votes
3 ans
30 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 5 months ago by Marcel
0 votes
2 ans
33 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 5 months ago by datguywhowanders
0 votes
3 ans
33 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 5 months ago by EzzDev
0 votes
2 ans
29 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 5 months ago by alpha_juno
0 votes
3 ans
34 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 5 months ago by John Crawford
0 votes
2 ans
30 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 5 months ago by Wolfgang Adamec
0 votes
2 ans
28 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 5 months ago by user502039
0 votes
3 ans
32 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 5 months ago by wessodesigner
0 votes
3 ans
28 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 5 months ago by Danil K
0 votes
3 ans
33 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 5 months ago by Graviton
0 votes
2 ans
32 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 5 months ago by GavinR
0 votes
2 ans
33 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 5 months ago by Wizard4U