LMSouq

Knowledge Base

Browse Moodle Solutions

2108 solutions found

Page 5 of 106
0 votes
1 ans
3 views
How can I remove a key and its value from an associative array?

Given an associative array: array("key1" => "value1", "key2" => "value2", ...) How would I go about remo...

php-dev Solved
GS
asked 1 month ago by gsquare567
0 votes
1 ans
3 views
How can I check if a URL exists via PHP?

How do I check if a URL exists (not 404) in PHP?

php-dev Solved
X1
asked 1 month ago by X10nD
0 votes
1 ans
3 views
Merging two arrays with the "+" (array union operator) How does it work?

I have some code that appears to merge the data from two arrays using `+=`, but it doesn't include all of the elements in the element. How does it work?...

php-dev Solved
US
asked 1 month ago by user198729
0 votes
1 ans
3 views
How to fix error with xml2-config not found when installing PHP from sources?

When I try to install php 5.3 stable from source on Ubuntu (downloading compressed installation file from http://www.php.net/downloads.php) and I run `./configu...

php-dev Solved
TR
asked 1 month ago by TroodoN-Mike
0 votes
1 ans
3 views
Using dynamic variable names in PHP

I'm trying to use dynamic variable names. So inside this loop I want to create `$file0`, `$file1`, and `$file2`: for($i=0; $i<=2; $i++) {...

php-dev Solved
US
asked 1 month ago by user1159454
0 votes
1 ans
3 views
How can I output a UTF-8 CSV in PHP that Excel will read properly?

I've got this very simple thing that just outputs some stuff in CSV format, but it's got to be UTF-8. I open this file in TextEdit or TextMate or Dreamw...

php-dev Solved
BE
asked 1 month ago by Ben Saufley
0 votes
1 ans
3 views
Find the last element of an array while using a foreach loop in PHP

I am writing a SQL query creator using some parameters. In Java, it's very easy to detect the last element of an array from inside the for loop by just chec...

php-dev Solved
VA
asked 1 month ago by Vaibhav Kamble
0 votes
1 ans
3 views
How to display HTML tags as plain text

I have an input form on my website where HTML is allowed and I'm trying to add instructions about the use of HTML tags. I'd like the text to <...

general-dev Solved
US
asked 1 month ago by user517593
0 votes
1 ans
3 views
How to increase maximum execution time in php

I want to increase *maximum execution time* in php , not by changing `php.ini` file. I want to Increase it from my php file. Is this possible?

php-dev Solved
PR
asked 1 month ago by Pritesh Mahajan
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
Fastest hash for non-cryptographic uses?

I'm essentially preparing phrases to be put into the database, they may be malformed so I want to store a short hash of them instead (I will be simply compa...

general-dev Solved
JO
asked 1 month ago by John
0 votes
1 ans
3 views
Facebook API - How do I get a Facebook user's profile image through the Facebook API (without requiring the user to "Allow" the application)

I'm working on a [CMS][1] that fetches a user's profile image from their Facebook [URL][2] (that is, http://facebook.com/users_unique_url). How can I ac...

general-dev Solved
JO
asked 1 month ago by John Himmelman
0 votes
2 ans
3 views
How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

I'm starting with the new Google service for the notifications, `Firebase Cloud Messaging`. Thanks to this code https://github.com/firebase/quickstart-a...

general-dev Solved
DA
asked 1 month ago by David Corral
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
Remove multiple whitespaces

I'm getting `$row['message']` from a MySQL database and I need to remove all whitespace like `\n` `\t` and so on. $row['message'] = &...

general-dev Solved
CR
asked 1 month ago by creativz
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