LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 2 of 19
0 votes
1 ans
3 views
Multi-line string literals in PHP

Consider: $xml = "l"; $xml = "vv"; echo $xml; This will echo `vv`. Why and how can I do multi-line string literals for...

php-dev Solved
TH
asked 1 month ago by TheBlackBenzKid
0 votes
1 ans
3 views
Remove first 4 characters of a string with PHP

How can I remove the first 4 characters of a string using PHP?

php-dev Solved
BE
asked 1 month ago by Belgin Fish
0 votes
1 ans
3 views
What is the best method to merge two PHP objects?

We have two PHP5 objects and would like to merge the content of one into the second. There are no notion of subclasses between them so the solutions described i...

php-dev Solved
VE
asked 1 month ago by Veynom
0 votes
1 ans
3 views
PHP prepend leading zero before single digit number, on-the-fly

PHP - Is there a quick, on-the-fly method to test for a single character string, then prepend a leading zero? Example: $year = 11; $month = 4;...

php-dev Solved
BE
asked 1 month ago by Ben
0 votes
1 ans
3 views
How to use PHP OPCache?

PHP 5.5 has been released and it features a new code caching module called OPCache, but there doesn't appear to be any documentation for it. So where is...

php-dev Solved
DA
asked 1 month ago by Danack
0 votes
1 ans
3 views
How to POST JSON Data With PHP cURL?

Here is my code, ``` $url = 'url_to_post'; $data = array( "first_name" => "First name", "last_name" =>...

php-dev Solved
US
asked 1 month ago by user1463076
0 votes
1 ans
3 views
How do I see the extensions loaded by PHP?

It's got to be somewhere in the phpinfo() dump, but I just don't know where. Is it supposed to be under the "Additional Modules" section? So...

php-dev Solved
BI
asked 1 month ago by Bialecki
0 votes
1 ans
3 views
Fastest way to convert string to integer in PHP

Using PHP, what's the fastest way to convert a string like this: `"123"` to an integer? Why is that particular method the fastest? What happens...

php-dev Solved
NI
asked 1 month ago by nickf
0 votes
1 ans
3 views
PHP check whether property exists in object or class

I understand PHP does not have a pure object variable, but I want to check whether a property is in the given object or class. $ob = (object) array('...

php-dev Solved
MI
asked 1 month ago by Micah
0 votes
1 ans
3 views
Fatal error: Class 'ZipArchive' not found in

I have a problem when I install 'Archive_Zip 0.1.1' on the Linux server, but when I try to run the script to create the zip file it gives the fatal erro...

php-dev Solved
PA
asked 1 month ago by Parag Chaure
0 votes
1 ans
3 views
How to include() all PHP files from a directory?

In PHP can I include a directory of scripts? i.e. Instead of: include('classes/Class1.php'); include('classes/Class2.php'); is...

php-dev Solved
OC
asked 1 month ago by occhiso
0 votes
1 ans
3 views
What is the meaning of three dots (...) in PHP?

While I am installing Magento 2 on my Server, I got an error. After investigating the code and found that there are three dots (`...`), which is producing the e...

php-dev Solved
AB
asked 1 month ago by abu abu
0 votes
1 ans
3 views
Laravel PHP command not found

I installed Laravel using Composer without problems, but when I try to run `laravel` in the terminal, I get the following error: > -bash: laravel: command...

php-dev Solved
CH
asked 1 month ago by chemitaxis
0 votes
1 ans
3 views
Send attachments with PHP Mail()?

I need to send a pdf with mail, is it possible? $to = "xxx"; $subject = "Subject" ; $message = 'Example message with...

php-dev Solved
US
asked 1 month ago by user1537415
0 votes
1 ans
3 views
Fatal error: Class 'SoapClient' not found

I'm trying a simple web service example and I get this error even though I uncommented `extension=php_soap.dll` in the `php.ini` file: > **Fatal error...

php-dev Solved
FI
asked 1 month ago by Figen Güngör
0 votes
1 ans
3 views
Get random item from array

$items = Array(523,3452,334,31,...5346); Each item of this array is some number. **How do I get random item from `$items`?**

php-dev Solved
JA
asked 1 month ago by James
0 votes
1 ans
3 views
Tactics for using PHP in a high-load site

Before you answer this I have never developed anything popular enough to attain high server loads. Treat me as (sigh) an alien that has just landed on the plane...

php-dev Solved
RO
asked 1 month ago by Ross
0 votes
1 ans
3 views
Correctly determine if date string is a valid date in that format

I'm receiving a date string from an API, and it is formatted as `yyyy-mm-dd`. I am currently using a regex to validate the string format, which works ok,...

php-dev Solved
MA
asked 1 month ago by Marty Wallace
0 votes
1 ans
3 views
Unzip a file with php

I want to unzip a file and this works fine system('unzip File.zip'); But I need to pass in the file name through the URL and can not get it to...

php-dev Solved
BO
asked 1 month ago by BostonBB
0 votes
1 ans
3 views
What does a \ (backslash) in front of function names mean?

What does a `\` do in PHP? For example, [CSRF4PHP](https://github.com/foxbunny/CSRF4PHP/blob/60d9172b7f0cd93346cac9065fb17182854ebf1c/CsrfToken.php#L80-L87)...

php-dev Solved
AL
asked 1 month ago by Alfred