LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 11 of 19
0 votes
1 ans
3 views
PHP mail function doesn't complete sending of e-mail

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from =...

php-dev Solved
US
asked 1 month ago by user3818620
0 votes
1 ans
3 views
Convert a date format in PHP

I am trying to convert a date from `yyyy-mm-dd` to `dd-mm-yyyy` (but not in SQL); however I don't know how the date function requires a timestamp, and I can...

php-dev Solved
MA
asked 1 month ago by matthy
0 votes
1 ans
3 views
How can I connect to a Tor hidden service using cURL in PHP?

I'm trying to connect to a Tor hidden service using the following PHP code: $url = 'http://jhiwjjlqpyawmpjx.onion/' $ch = curl_init();...

php-dev Solved
FR
asked 1 month ago by frosty
0 votes
1 ans
3 views
PHP equivalent of .NET/Java's toString()

How do I convert the value of a PHP variable to string? I was looking for something better than concatenating with an empty string: $myText = $myVar ....

php-dev Solved
AN
asked 1 month ago by Antoine Aubry
0 votes
1 ans
3 views
Fastest way to check if a string is JSON in PHP?

I need a really, really fast method of checking if a string is JSON or not. I feel like this is not the best way: function isJson($string) { ret...

php-dev Solved
KI
asked 1 month ago by Kirk Ouimet
0 votes
1 ans
3 views
What does double question mark (??) operator mean in PHP

I was diving into Symfony framework (version 4) code and found this piece of code: $env = $_SERVER['APP_ENV'] ?? 'dev'; I'm not su...

php-dev Solved
EL
asked 1 month ago by elkolotfi
0 votes
1 ans
3 views
Are PHP short tags acceptable to use?

Here's the information [according to the official documentation][1]: > There are four different pairs of > opening and closing tags which can be...

php-dev Solved
MD
asked 1 month ago by MDCore
0 votes
1 ans
3 views
Check if PHP session has already started

I have a PHP file that is sometimes called from a page that has started a session and sometimes from a page that doesn't have session started. Therefore whe...

php-dev Solved
AR
asked 1 month ago by Arda
0 votes
1 ans
3 views
Laravel Add a new column to existing table in a migration

I can't figure out how to add a new column to my existing database table using the Laravel framework. I tried to edit the migration file using... <...

php-dev Solved
KI
asked 1 month ago by kim larsen
0 votes
1 ans
3 views
How to get the file extension in PHP?

I wish to get the file extension of an image I am uploading, but I just get an array back. $userfile_name = $_FILES['image']['name'];...

php-dev Solved
KE
asked 1 month ago by Keith Power
0 votes
1 ans
3 views
How to convert an array to object in PHP?

How can I convert an array like this to an object? ``` [128] => Array ( [status] => "Figure A. Facebook's horizontal scrollba...

php-dev Solved
ST
asked 1 month ago by streetparade
0 votes
1 ans
3 views
How to run single test method with phpunit?

I am struggling to run a single test method named `testSaveAndDrop` in the file `escalation/EscalationGroupTest.php` with `phpunit`. I tried the following combi...

php-dev Solved
AL
asked 1 month ago by Alex
0 votes
1 ans
3 views
How to define an empty object in PHP

with a new array I do this: $aVal = array(); $aVal[key1][var1] = "something"; $aVal[key1][var2] = "something else";...

php-dev Solved
ED
asked 1 month ago by ed209
0 votes
1 ans
3 views
How can one use multi threading in PHP applications

Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could forc...

php-dev Solved
ST
asked 1 month ago by Steve Obbayi
0 votes
1 ans
3 views
What is a Python equivalent of PHP's var_dump()?

When debugging in PHP, I frequently find it useful to simply stick a [var_dump()][1] in my code to show me what a variable is, what its value is, and the same f...

php-dev Solved
ZO
asked 1 month ago by Zoredache
0 votes
1 ans
3 views
How to generate a random, unique, alphanumeric string?

How would it be possible to generate a random, unique string using numbers and letters for use in a verify link? Like when you create an account on a website, a...

php-dev Solved
AN
asked 1 month ago by Andrew
0 votes
1 ans
3 views
How can I find the php.ini file used by the command line?

I need to enable *pdo_mysql* in my [EasyPHP][1] environment, so I went to the *php.ini* file and uncommented the following line: extension=php_pdo_mysql....

php-dev Solved
AM
asked 1 month ago by Amokrane Chentir
0 votes
1 ans
3 views
Use json_decode() to create array insead of an object

I am trying to decode a JSON string into an array but i get the following error. > Fatal error: Cannot use object of type stdClass as array Here is the...

php-dev Solved
HA
asked 1 month ago by Harsha M V
0 votes
1 ans
3 views
In PHP, what is a closure and why does it use the "use" identifier?

I'm checking out some `PHP 5.3.0` features and ran across some code on the site that looks quite funny: public function getTotal($tax) {...

php-dev Solved
SE
asked 1 month ago by SeanDowney
0 votes
1 ans
3 views
How to loop through PHP object with dynamic keys

I tried to parse a JSON file using PHP. But I am stuck now. This is the content of my JSON file: ```json { "John": { "status":&q...

php-dev Solved
JO
asked 1 month ago by John Doe