LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 24 of 106
0 votes
1 ans
3 views
How can I add elements to an empty array in PHP?

If I define an array in PHP such as (I don't define its size): <!-- language: lang-php --> $cart = array(); Do I simply add elements to i...

php-dev Solved
AQ
asked 1 month ago by AquinasTub
0 votes
1 ans
3 views
Is there a function to make a copy of a PHP array to another?

Is there a function to make a copy of a PHP array to another? I have been burned a few times trying to copy PHP arrays. I want to copy an array defined insid...

php-dev Solved
VF
asked 1 month ago by vfclists
0 votes
1 ans
3 views
PHP expects T_PAAMAYIM_NEKUDOTAYIM?

Does anyone have a `T_PAAMAYIM_NEKUDOTAYIM`?

php-dev Solved
PE
asked 1 month ago by Peter Turner
0 votes
1 ans
3 views
How can I get useful error messages in PHP?

Quite often I will try and run a PHP script and just get a blank screen back. No error message; just an empty screen. The cause might have been a simple syntax...

php-dev Solved
CA
asked 1 month ago by Candidasa
0 votes
1 ans
3 views
Converting an integer to a string in PHP

Is there a way to convert an integer to a string in PHP?

php-dev Solved
KM
asked 1 month ago by kman99
0 votes
1 ans
3 views
How to check whether an array is empty using PHP?

`players ` will either be empty or a comma separated list (or a single value). What is the easiest way to check if it's empty? I'm assuming I can do so...

php-dev Solved
AS
asked 1 month ago by aslum
0 votes
1 ans
3 views
What is the use of the @ symbol in PHP?

I have seen uses of `@` in front of certain functions, like the following: $fileHandle = @fopen($fileName, $writeAttributes); What is the use of this...

php-dev Solved
SV
asked 1 month ago by sv_in
0 votes
1 ans
3 views
Can I bind an array to an IN() condition in a PDO query?

I'm curious to know if it's possible to bind an array of values to a placeholder using PDO. The use case here is attempting to pass an array of values...

database Solved
AN
asked 1 month ago by Andru
0 votes
1 ans
3 views
PHP, cURL, and HTTP POST example?

Can anyone show me how to do a PHP cURL with an HTTP POST? I want to send data like this: username=user1, password=passuser1, gender=1 To `www.exam...

php-dev Solved
MY
asked 1 month ago by mysqllearner
0 votes
1 ans
3 views
How to pass an array within a query string?

Is there a standard way of passing an array through a query string? To be clear, I have a query string with multiple values, one of which would be an array...

database Solved
YA
asked 1 month ago by Yarin
0 votes
1 ans
3 views
Insert new item in array on any position in PHP

How can I insert a new item into an array on any position, for example in the middle of array?

php-dev Solved
KU
asked 1 month ago by kusanagi
0 votes
1 ans
3 views
PHP How to determine the first and last iteration in a foreach loop?

The question is simple. I have a `foreach` loop in my code: foreach($array as $element) { //code } In this loop, I want to react differe...

php-dev Solved
ME
asked 1 month ago by mehdi
0 votes
1 ans
3 views
How to create custom helper functions in Laravel

I would like to create helper functions to avoid repeating code between views in Laravel. For example: *view.blade.php* <p>Foo Formated text: {{...

php-dev Solved
CA
asked 1 month ago by Calebe Oliveira
0 votes
1 ans
3 views
Sort an array of associative arrays by column value

Given this array: $inventory = array( array("type"=>"fruit", "price"=>3.50), array("type&q...

php-dev Solved
MA
asked 1 month ago by Matt
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
How do I catch a PHP fatal (`E_ERROR`) error?

I can use `set_error_handler()` to catch most PHP errors, but it doesn't work for fatal (`E_ERROR`) errors, such as calling a function that doesn't exis...

php-dev Solved
TO
asked 1 month ago by too much php
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
How to Create Multiple Where Clause Query Using Laravel Eloquent?

I'm using the Laravel Eloquent query builder and I have a query where I want a `WHERE` clause on multiple conditions. It works, but it's not elegant....

database Solved
VE
asked 1 month ago by veksen