366 solutions found in php-dev
Page 12 of 19votes
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:...
votes
Scenario: trait A { function calc($v) { return $v+1; } } class MyClass { use A;...
votes
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...
votes
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?
votes
How can I convert string to `boolean`? $string = 'false'; $test_mode_mail = settype($string, 'boolean'); var_dump($...
votes
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...
votes
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'...
votes
Take a look at this code: $GET = array(); $key = 'one=1'; $rule = explode('=', $key); /* array_push($GET, $rule[0] =&g...
votes
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...
votes
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...
votes
How do the following two function calls compare: isset($a['key']) array_key_exists('key', $a)
votes
This failed: define('DEFAULT_ROLES', array('guy', 'development team')); Apparently, constants can't hold arrays. What is...
votes
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...
votes
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://...
votes
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...
votes
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...
votes
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...
votes
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...
votes
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...
votes
`time()` is in seconds. Is there one in milliseconds?