2108 solutions found
Page 20 of 106votes
I would think the following piece of code should work, but it doesn't **(Edited: Now works in PHP 5.5+)**: if (!empty($r->getError())) Where `g...
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
The callback function in [`array_filter()`][1] only passes in the array's values, not the keys. If I have: $my_array = array("foo" =...
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'm trying to use the `Artisan` command like this: php artisan serve It displays: > Laravel development server started: <http://127.0.0.1...
votes
When a PHP application makes a database connection it of course generally needs to pass a login and password. If I'm using a single, minimum-permission logi...
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
What is the difference between [`PDOStatement::bindParam()`][1] and [`PDOStatement::bindValue()`][2]? [1]: http://www.php.net/manual/en/pdostatement.bind...
votes
I have a string returned to one of my views, like this: $text = '<p><strong>Lorem</strong> ipsum dolor <img src="images/tes...
votes
<?php for ($i = 'a'; $i <= 'z'; $i++) echo "$i\n"; This snippet gives the following output (newlines are re...
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 need to catch some warnings being thrown from some php native functions and then handle them. Specifically: array dns_get_record ( string $hostname...