366 solutions found in php-dev
Page 13 of 19votes
Is it possible write a string or log into the console? ## What I mean Just like in JSP, if we print something like `system.out.println("some")`,...
votes
I have an associative array in the form `key => value` where key is a numerical value, however it is not a sequential numerical value. The key is actually an...
votes
What exactly is the difference between `array_map`, `array_walk` and `array_filter`. What I could see from documentation is that you could pass a callback funct...
votes
Is there any way to get both headers and body for a cURL request using PHP? I found that this option: curl_setopt($ch, CURLOPT_HEADER, true); is going...
votes
How would I go about grabbing the last 7 characters of the string below? For example: $dynamicstring = "2490slkj409slk5409els"; $newstr...
votes
I am new to Laravel. How do I find if a record exists? <!-- language: lang-php --> $user = User::where('email', '=', Input...
votes
I'm currently using the below code to insert data in a table: <!-- language: php --> <?php public function saveDetailsCompany(...
votes
Our client had given me a REST API to which I need to make a PHP call. But as a matter of fact, the documentation given with the API is very limited, so I don&#...
votes
I submit as POST to a PHP page the following data: ```json {a:1} ``` In my PHP code, what do I have to do to extract that value? ```php var_dump($_PO...
votes
You can't put two __construct functions with unique argument signatures in a PHP class. I'd like to do this: class Student { protec...
votes
I'm struggling to understand the difference between `shell_exec()` and `exec()`... I've always used `exec()` to execute server side commands, when wo...
votes
What is the easiest way to encode a PHP string for output to a JavaScript variable? I have a PHP string which includes quotes and newlines. I need the conte...
votes
I want to extract the digits from a string that contains numbers and letters like: "In My Cart : 11 items" I want to extract the number `11`...
votes
I have recently installed Laravel 5 via Composer. I tried creating a new controller using Artisan and got the following error. Am I missing something? >bo...
votes
How do you debug **PHP** scripts? I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in **PHPEclipse** is also quite u...
votes
I saw this today in some PHP code: $items = $items ?: $this->_handle->result('next', $this->_result, $this); I'm not familiar wit...
votes
In JavaScript, you can easiliy create an object without a class by: myObj = {}; myObj.abc = "aaaa"; For PHP I've found this one,...
votes
How can I remove three characters at the end of a string in PHP? "abcabcabc" would become "abcabc"!
votes
How to append one array to another without comparing their keys? $a = array( 'a', 'b' ); $b = array( 'c', 'd' ); At...
votes
How do I get timestamp from e.g. `22-09-2008`?