2108 solutions found
Page 21 of 106votes
How do I say `WHERE (a = 1 OR b =1 ) AND (c = 1 OR d = 1)` For more complicated queries am I supposed to use raw SQL?
votes
If I want to create a URL using a variable I have two choices to encode the string. `urlencode()` and `rawurlencode()`. What exactly are the differences and...
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
I want a version of `str_replace()` that only replaces the first occurrence of `$search` in the `$subject`. Is there an easy solution to this, or do I need a ha...
votes
I need to remove all characters from a string which aren't in `a-z A-Z 0-9` set or are not spaces. Does anyone have a function to do this?
votes
`time()` is in seconds. Is there one in milliseconds?
votes
Is there any way of taking a screenshot of a website in PHP, then saving it to a file?
votes
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
I keep reading it is poor practice to use the PHP close tag `?>` at the end of the file. The header problem seems irrelevant in the following context (and th...
votes
How would I go about grabbing the last 7 characters of the string below? For example: $dynamicstring = "2490slkj409slk5409els"; $newstr...
votes
I want to create a directory if it does not exist already. Is using the `is_dir` function enough for that purpose? if ( !is_dir( $dir ) ) { m...
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
How do I set a default value in Doctrine 2?
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...