LMSouq

Knowledge Base

Browse Moodle Solutions

2110 solutions found

Page 9 of 106
0 votes
2 ans
36 views
PHP - concatenate or directly insert variables in string

I am wondering, What is the proper way for inserting PHP variables into a string? <br/><br/> **This way:**<br/> echo "Welcome &q...

php-dev Solved
WE
asked 5 months ago by Web_Designer
0 votes
2 ans
45 views
Remove warning messages in PHP

I have some PHP code. When I run it, a warning message appears. How can I remove/suppress/ignore these warning messages?

php-dev Solved
AL
asked 5 months ago by Alireza
0 votes
2 ans
34 views
How do I make a request using HTTP basic authentication with PHP curl?

I'm building a REST web service client in PHP and at the moment I'm using curl to make requests to the service. How do I use curl to make authenticat...

php-dev Solved
BL
asked 5 months ago by blank
0 votes
3 ans
35 views
How can I echo or print an array in PHP?

I have this array Array ( [data] => Array ( [0] => Array ( [page_id] => 204725966262...

php-dev Solved
EN
asked 5 months ago by EnexoOnoma
0 votes
3 ans
30 views
How can I add a PHP page to WordPress?

I want to create a custom page for my WordPress blog that will execute my PHP code in it, whilst remaining a part of the overall site CSS/theme/design. The P...

php-dev Solved
CI
asked 5 months ago by citronic
0 votes
3 ans
33 views
How to convert array to SimpleXML

How can I convert an array to a SimpleXML object in PHP?

php-dev Solved
MI
asked 5 months ago by Mike
0 votes
3 ans
38 views
Test if number is odd or even

What is the simplest most basic way to find out if a number/variable is odd or even in PHP? Is it something to do with mod? I've tried a few scripts but...

general-dev Solved
US
asked 5 months ago by user1022585
0 votes
3 ans
34 views
How do I create a simple 'Hello World' module in Magento?

How can the following be accomplished in Magento? - Display a "Hello World" message using a controller/view/model approach. So, if I went to `http:...

general-dev Solved
AL
asked 5 months ago by Ali
0 votes
3 ans
30 views
Switch php versions on commandline ubuntu 16.04

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod...

server-admin Solved
SA
asked 5 months ago by salimsaid
0 votes
3 ans
31 views
What do strict types do in PHP?

I've seen the following new line in PHP 7, but nobody really explains what it means. I've googled it and all they talk about is will you be enabling it...

php-dev Solved
SU
asked 5 months ago by sufuko
0 votes
3 ans
31 views
How to extract and access data from JSON with PHP?

> This is intended to be a general reference question and answer covering many of the never-ending *"How do I access data in my JSON?"* questions....

php-dev Solved
US
asked 5 months ago by user3942918
0 votes
3 ans
34 views
How to save an HTML5 Canvas as an image on a server?

I'm working on a generative art project where I would like to allow users to save the resulting images from an algorithm. The general idea is: * Create a...

server-admin Solved
NA
asked 5 months ago by nathan lachenmyer
0 votes
2 ans
34 views
How to get name of calling function/method in PHP?

I am aware of function `debug_backtrace`, but I am looking for some ready to use implementation of function like `GetCallingMethodName()`? It would be perfect i...

php-dev Solved
DA
asked 5 months ago by Dawid Ohia
0 votes
2 ans
37 views
Getting the first character of a string with $str[0]

I want to get the first letter of a string and I've noticed that `$str[0]` works great. I am just not sure whether this is 'good practice', as that...

php-dev Solved
TA
asked 5 months ago by Tatu Ulmanen
0 votes
3 ans
36 views
"Keep Me Logged In" - the best approach

My web application uses sessions to store information about the user once they've logged in, and to maintain that information as they travel from page to pa...

general-dev Solved
MA
asked 5 months ago by Matthew
0 votes
3 ans
33 views
require(vendor/autoload.php): failed to open stream

I know that this issue has been posted many times, but for me it seems to be a different problem. Indeed, this error > Warning: require(vendor/autoload.ph...

php-dev Solved
AD
asked 5 months ago by adrTuIPKJ44
0 votes
3 ans
31 views
Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

Because of the Twitter API 1.0 retirement as of [June 11th 2013](https://dev.twitter.com/blog/api-v1-retirement-date-extended-to-june-11), the script below does...

php-dev Solved
FE
asked 5 months ago by fellowworldcitizen
0 votes
2 ans
34 views
How to validate an email address in PHP

I have this function to validate an email addresses: function validateEMAIL($EMAIL) { $v = "/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/&quot...

php-dev Solved
CA
asked 5 months ago by Cameron
0 votes
3 ans
32 views
Why check both isset() and !empty()

Is there a difference between `isset` and `!empty`. If I do this double boolean check, is it correct this way or redundant? and is there a shorter way to do the...

general-dev Solved
SI
asked 5 months ago by silow
0 votes
2 ans
34 views
What is the size limit of an HTTP POST request?

Sorry if this is duplicate,I would think it would be but couldn't find anything. I have a flex application that I am posting data back to a PHP/MySQL ser...

general-dev Solved
IN
asked 5 months ago by invertedSpear