LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 12 of 19
0 votes
1 ans
3 views
How can I perform static code analysis in PHP?

Is there a static analysis tool for PHP source files? The binary itself can check for syntax errors, but I'm looking for something that does more, like:...

php-dev Solved
ES
asked 1 month ago by eswald
0 votes
1 ans
3 views
How to override trait function and call it from the overridden function?

Scenario: trait A { function calc($v) { return $v+1; } } class MyClass { use A;...

php-dev Solved
SH
asked 1 month ago by Shu
0 votes
1 ans
3 views
PHP cURL custom headers

I'm wondering if/how you can add custom headers to a cURL HTTP request in PHP. I'm trying to emulate how iTunes grabs artwork and it uses these non-stan...

php-dev Solved
12
asked 1 month ago by 123
0 votes
1 ans
3 views
PHPUnit assert that an exception was thrown?

Does anyone know whether there is an `assert` or something like that which can test whether an exception was thrown in the code being tested?

php-dev Solved
FE
asked 1 month ago by Felipe
0 votes
1 ans
3 views
How to convert string to boolean php

How can I convert string to `boolean`? $string = 'false'; $test_mode_mail = settype($string, 'boolean'); var_dump($...

php-dev Solved
RU
asked 1 month ago by Run
0 votes
1 ans
3 views
Get the first level key of the first row containing a specified column value in a 2d array

I have an array where I want to search the `uid` and get the key of the array. ## Examples Assume we have the following 2-dimensional array: $userdb...

php-dev Solved
RA
asked 1 month ago by Rachit
0 votes
1 ans
3 views
PHPDoc type hinting for array of objects?

So, in PHPDoc one can specify `@var` above the member variable declaration to hint at its type. Then an IDE, for ex. PHPEd, will know what type of object it&#39...

php-dev Solved
AR
asked 1 month ago by Artem Russakovskii
0 votes
1 ans
3 views
How to push both value and key into PHP array

Take a look at this code: $GET = array(); $key = 'one=1'; $rule = explode('=', $key); /* array_push($GET, $rule[0] =&g...

php-dev Solved
GA
asked 1 month ago by Gal
0 votes
1 ans
3 views
Call to undefined function curl_init()?

When i am going to implement Authorize.net payment gateway. However, I got this error: > Call to undefined function curl_init() Please let me know wha...

php-dev Solved
PR
asked 1 month ago by Pramod Kumar Sharma
0 votes
1 ans
3 views
Laravel requires the Mcrypt PHP extension

I am trying to use the `migrate` function in Laravel 4 on OSX. However, I am getting the following error: Laravel requires the Mcrypt PHP extension. A...

php-dev Solved
PA
asked 1 month ago by Patrick Reck
0 votes
1 ans
3 views
What's the difference between isset() and array_key_exists()?

How do the following two function calls compare: isset($a['key']) array_key_exists('key', $a)

php-dev Solved
ZA
asked 1 month ago by Zacky112
0 votes
1 ans
3 views
PHP Constants Containing Arrays?

This failed: define('DEFAULT_ROLES', array('guy', 'development team')); Apparently, constants can't hold arrays. What is...

php-dev Solved
NI
asked 1 month ago by Nick Heiner
0 votes
1 ans
3 views
Saving image from PHP URL

I need to save an image from a PHP URL to my PC. Let's say I have a page, `http://example.com/image.php`, holding a single "flower" image, nothin...

php-dev Solved
RI
asked 1 month ago by riad
0 votes
1 ans
3 views
When do I use the PHP constant "PHP_EOL"?

When is it a good idea to use [`PHP_EOL`][1]? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues? [1]: https://...

php-dev Solved
CH
asked 1 month ago by Christian Oudard
0 votes
1 ans
3 views
How to set up file permissions for Laravel?

I'm using Apache Web Server that has the owner set to `_www:_www`. I never know what is the best practice with file permissions, for example when I create n...

php-dev Solved
RO
asked 1 month ago by Robo Robok
0 votes
1 ans
3 views
Creating default object from empty value in PHP?

I see this error only after upgrading my PHP environment to PHP 5.4 and beyond. The error points to this line of code: Error: >Creating default object...

php-dev Solved
PA
asked 1 month ago by Paul
0 votes
1 ans
3 views
Receive JSON POST with PHP

I’m trying to receive a JSON POST on a payment interface website, but I can’t decode it. When I print : echo $_POST; I get: Array The p...

php-dev Solved
PA
asked 1 month ago by Pablo Ramirez
0 votes
1 ans
3 views
What does PHP keyword 'var' do?

This is probably a very trivial question, but I haven't been able to find the answer neither through web search engines, nor on php.net. Please just direct...

php-dev Solved
JO
asked 1 month ago by joelpet
0 votes
1 ans
3 views
PHP code is not being executed, but the code shows in the browser source code

I'm trying to execute some PHP code on a project (using Dreamweaver) but the code isn't being run. When I check the source code, the PHP code appears...

php-dev Solved
GU
asked 1 month ago by Gui
0 votes
1 ans
3 views
How can I get the current time in milliseconds in PHP?

`time()` is in seconds. Is there one in milliseconds?

php-dev Solved
CO
asked 1 month ago by COMer