LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 10 of 106
0 votes
1 ans
3 views
How to insert an item at the beginning of an array in PHP?

I know how to insert it to the end by: $arr[] = $item; But how to insert it to the beginning?

php-dev Solved
WE
asked 1 month ago by web
0 votes
1 ans
3 views
Disable Laravel's Eloquent timestamps

I'm in the process of converting one of our web applications from CodeIgniter to Laravel. However at this moment we don't want to add the `updated_at` /...

php-dev Solved
MA
asked 1 month ago by mattcdev
0 votes
1 ans
3 views
PHP: Return all dates between two dates in an array

**Expected Input:** getDatesFromRange( '2010-10-01', '2010-10-05' ); **Expected Output:** Array( '2010-10-01', '201...

php-dev Solved
HY
asked 1 month ago by HyderA
0 votes
1 ans
3 views
Is it possible to delete an object's property in PHP?

If I have an `stdObject` say, `$a`. Sure there's no problem to assign a new property, `$a`, $a->new_property = $xyz; But then I want to remo...

php-dev Solved
VA
asked 1 month ago by valk
0 votes
1 ans
3 views
Convert DateTime to String PHP

I have already researched a lot of site on how can I convert PHP DateTime object to String. I always see "String to DateTime" and not "DateTime...

php-dev Solved
NE
asked 1 month ago by Netorica
0 votes
1 ans
3 views
Doctrine2: Best way to handle many-to-many with extra columns in reference table

I'm wondering what's the best, the cleanest and the most simply way to work with many-to-many relations in Doctrine2. Let's assume that we'v...

general-dev Solved
CR
asked 1 month ago by Crozin
0 votes
1 ans
3 views
Setting Curl's Timeout in PHP

I'm running a curl request on an eXist database through php. The dataset is very large, and as a result, the database consistently takes a long amount of ti...

php-dev Solved
MO
asked 1 month ago by Moki
0 votes
1 ans
3 views
How to check if a value is in a multidimensional array

I use `in_array()` to check whether a value exists in an array like below, $a = array("Mac", "NT", "Irix", "Linux&quot...

php-dev Solved
RU
asked 1 month ago by Run
0 votes
1 ans
3 views
Split string by new line characters

I have a string with new line characters. I want to convert that string into an array, and for every new line, jump one index place in the array. If the stri...

php-dev Solved
JO
asked 1 month ago by Johan
0 votes
1 ans
3 views
Best way to allow plugins for a PHP application

I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one...

php-dev Solved
WA
asked 1 month ago by Wally Lawless
0 votes
1 ans
3 views
Composer install error - requires ext_curl when it's actually enabled

I'm trying to install Facebook PHP SDK with Composer. This is what I get $ composer install Loading composer repositories with package informati...

php-dev Solved
MI
asked 1 month ago by Michal Artazov
0 votes
1 ans
3 views
PHP Redirect with POST data

I did some research on this topic, and there are some experts who have said that it is not [possible](https://stackoverflow.com/questions/3045097/php-redirect-a...

php-dev Solved
SH
asked 1 month ago by Shiro
0 votes
1 ans
3 views
What is <=> (the 'Spaceship' Operator) in PHP 7?

PHP 7 introduced the Spaceship (&lt;=&gt;) operator. What is it and how does it work?

php-dev Solved
DE
asked 1 month ago by Deepak Mankotia
0 votes
1 ans
3 views
How to configure XAMPP to send mail from localhost?

I am trying to send mail from localhost. but i am unable to send the mail from localhost so can anybody tell me that how to reconfigure my xampp to send mail...

general-dev Solved
FA
asked 1 month ago by farid shaikh
0 votes
1 ans
3 views
Adding days to $Date in PHP

I have a date returned as part of a MySQL query in the form `2010-09-17`. I would like to set the variables $Date2 to $Date5 as follows: `$Date2 = $Date +...

php-dev Solved
IS
asked 1 month ago by Istari
0 votes
1 ans
3 views
Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago...

I am trying to convert a timestamp of the format `2009-09-12 20:57:19` and turn it into something like `3 minutes ago` with PHP. I found a useful script to d...

php-dev Solved
WI
asked 1 month ago by willdanceforfun
0 votes
1 ans
3 views
Remove characters that aren't letters and numbers, replace space with a hyphen

I am facing an issue with URLs, I want to be able to convert titles that could contain anything and have them stripped of all special characters so they only ha...

general-dev Solved
US
asked 1 month ago by user115422
0 votes
1 ans
3 views
Creating PHP class instance with a string

I have two classes, `class ClassOne { }` and `class ClassTwo {}`. I am getting a string which can be either `&quot;One&quot;` or `&quot;Two&quot;`. Instead o...

php-dev Solved
JO
asked 1 month ago by Joel
0 votes
1 ans
3 views
How to execute a background process?

I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the use...

general-dev Solved
TI
asked 1 month ago by tim
0 votes
1 ans
3 views
Add a custom attribute to a Laravel / Eloquent model on load?

I&#39;d like to be able to add a custom attribute/property to an Laravel/Eloquent model when it is loaded. For instance, at the moment, in my controller I ha...

php-dev Solved
CO
asked 1 month ago by coatesap