366 solutions found in php-dev
Page 10 of 19votes
I've recently stumbled over this code: function xrange($min, $max) { for ($i = $min; $i <= $max; $i++) { yield $i;...
votes
I've found an error on a page in my Magento application; it always show this message error when I visit it: > Fatal error: Class 'DOMDocument'...
votes
If I have PHP script, how can I get the filename of the currently executed file without its extension? Given the name of a script of the form "jquery.j...
votes
I wanted to run some PHP right on my Mac, uncommented httpd.conf, activated web sharing, installed MySQL etc. I can't seem to find my PHP files, most impor...
votes
> This question is intended as a reference for questions about sorting arrays in PHP. It is easy to think that your particular case is unique and worthy of a...
votes
What's the easiest way to profile a PHP script? I'd love tacking something on that shows me a dump of all function calls and how long they took, but...
votes
In Laravel v4 I was able to get the current route name using... <!-- language: php --> Route::currentRouteName() How can I do it in **Laravel...
votes
I know there are a plethora of **$_SERVER** variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to m...
votes
The following code: $string = "1,2,3" $ids = explode(',', $string); var_dump($ids); Returns the array: array(3)...
votes
How to read if a checkbox is checked in PHP?
votes
1) When an array is passed as an argument to a method or function, is it passed by reference, or by value? 2) When assigning an array to a variable, is the n...
votes
How do I prevent [XSS][1] (cross-site scripting) using just HTML and PHP? I've seen numerous other posts on this topic, but I have not found an article t...
votes
I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment: Warning: POST Content-Length of 8978294 bytes exceeds...
votes
How to get first 5 characters from string using php $myStr = "HelloWordl"; result should be like this $result = "Hello";
votes
I have a timestamp stored in a session (1299446702). How can I convert that to a readable date/time in PHP? I have tried srttotime, etc. to no avail.
votes
I have a input string like: $str = ':this is a applepie :) '; How can I remove the first occurring `:` with PHP? Desired output: `this is a...
votes
Is there a way of doing something like this: $test_array = array( "first_key" => "first_value", "second_ke...
votes
How can I get the first n characters of a string in PHP? What's the fastest way to trim a string to a specific number of characters, and append '...'...
votes
After using PHP for a while now, I've noticed that not all built-in PHP functions are as fast as expected. Consider these two possible implementations of a...
votes
Ok, I know all about [`array_pop()`][1], but that deletes the last element. How to get the last element of an array without deleting it? Here's a bon...