LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 12 of 106
0 votes
1 ans
3 views
PHP array: count or sizeof?

To find the number of elements in a PHP `$array`, which is [faster/better/stronger][1]? `count($array)` or `sizeof($array)` ? Edit ---- Thanks to Andy...

php-dev Solved
BE
asked 1 month ago by Ben
0 votes
1 ans
3 views
Exploitable PHP functions

I'm trying to build a list of functions that can be used for arbitrary code execution. The purpose isn't to list functions that should be blacklisted or...

php-dev Solved
TY
asked 1 month ago by tylerl
0 votes
1 ans
3 views
Laravel: Get base URL

Simple question, but the answer seems quite hard to come by. In Codeigniter, I could load the URL helper and then simply do echo base_url(); to get my...

php-dev Solved
IN
asked 1 month ago by Inigo
0 votes
1 ans
3 views
How to get multiple selected values of select box in php?

I have a html form which has a select list box from which you can select multiple values because its multiple property is set to multiple. Consider form method...

php-dev Solved
PA
asked 1 month ago by Param-Ganak
0 votes
1 ans
3 views
PHP server on local machine?

I'm trying to build a PHP site and I'm wanting to test my PHP files without uploading them to my host. Basically testing them on my own machine before I...

server-admin Solved
KO
asked 1 month ago by Kozy
0 votes
1 ans
3 views
How do I get a PHP class constructor to call its parent's parent's constructor?

I need to have a class constructor in PHP call its parent's **parent's** (grandparent?) constructor without calling the parent constructor. // ma...

php-dev Solved
PA
asked 1 month ago by Paulo
0 votes
1 ans
3 views
PHPMailer character encoding issues

I try to use PHPMailer to send registration, activation. etc mail to users: require("class.phpmailer.php"); $mail -> charSet = "UT...

php-dev Solved
HO
asked 1 month ago by Holian
0 votes
1 ans
3 views
How do I install the ext-curl extension with PHP 7?

I've installed PHP 7 using [this repo][1], but when I try to run ``composer install``, it's giving this error: > - [package] requires ext-curl * -...

php-dev Solved
ST
asked 1 month ago by Stephan Vierkant
0 votes
1 ans
3 views
What's the difference between require and require-dev?

I would like to know the difference between `require` and `require-dev`. The composer website doesn't offer a good explanation the difference between thes...

general-dev Solved
SL
asked 1 month ago by slier
0 votes
1 ans
3 views
Get the first N elements of an array?

What is the best way to accomplish this?

php-dev Solved
GS
asked 1 month ago by GSto
0 votes
1 ans
3 views
How to get file name without file extension?

I have this PHP code: function ShowFileExtension($filepath) { preg_match('/[^?]*/', $filepath, $matches); $string = $match...

general-dev Solved
MO
asked 1 month ago by Mostafa Elkady
0 votes
1 ans
3 views
What Are the Differences Between PSR-0 and PSR-4?

Recently I've read about namespaces and how they are beneficial. I'm currently creating a project in Laravel and trying to move from class map autoloadi...

general-dev Solved
VA
asked 1 month ago by Varun Nath
0 votes
1 ans
3 views
PHP DOMDocument loadHTML not encoding UTF-8 correctly

I'm trying to parse some HTML using DOMDocument, but when I do, I suddenly lose my encoding (at least that is how it appears to me). $profile = &quot...

php-dev Solved
SL
asked 1 month ago by Slightly A.
0 votes
2 ans
3 views
PHP - Debugging Curl

I'd like to see what the post fields in the request are before I send it. (For debugging purposes). The PHP library (class) I am using is already made (n...

php-dev Solved
MA
asked 1 month ago by Matthew
0 votes
1 ans
3 views
Is there an equivalent for var_dump (PHP) in Javascript?

We need to see what methods/fields an object has in Javascript.

php-dev Solved
ED
asked 1 month ago by eddy147
0 votes
1 ans
3 views
What's better at freeing memory with PHP: unset() or $var = null

I realise the second one avoids the overhead of a function call (**update**, is actually a language construct), but it would be interesting to know if one is be...

php-dev Solved
AL
asked 1 month ago by alex
0 votes
1 ans
3 views
Getting visitors country from their IP

I want to get visitors country via their IP... Right now I'm using this (http://api.hostip.info/country.php?ip=...... ) Here is my code: <?php...

general-dev Solved
AL
asked 1 month ago by Alex C.
0 votes
1 ans
3 views
What is phtml, and when should I use a .phtml extension rather than .php?

I'm wondering what the difference between .phtml and .php files is, and when to use one over the other.

php-dev Solved
FV
asked 1 month ago by fvgs
0 votes
1 ans
3 views
Cross-Origin Request Headers(CORS) with PHP headers

I have a simple PHP script that I am attempting a cross-domain CORS request: <?php header("Access-Control-Allow-Origin: *"); heade...

php-dev Solved
US
asked 1 month ago by user1022241
0 votes
1 ans
3 views
Get absolute path of initially run script

I have searched high and low and get a lot of different solutions and variables containing info to get the absolute path. But they seem to work under some cond...

general-dev Solved
IN
asked 1 month ago by inquam