Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
PHP is a widely-used, general-purpose scripting language that is especially suited for web development.
1
vote
Accepted
A shorter way for getting variables
Since PHP 5.3 you can use the shortcut $a = $b? : $c:
$this->uniqueSessionKey = $settings->get('uniqueSessionKey') ? … $a : $default;
}
$a = getIfSet($b,$c);
Passing var by reference (&$a) avoid the PHP notice if $a is not set. …
5
votes
1
answer
3k
views
Get ranges from array of days
I have an array of dates as input in the form "YYYY-mm-dd"=>category_id.0 (category_id counting from 0).
$days =array (
'2014-10-15' => 49,
'2014-10-16' => 49,
'2014-10-17' => 49,
'2014-10-18 …
3
votes
Performing database interactions
First:
function __construct($host='localhost',$user,$pass,$dbname) {
You shouldn't follow an optional argument by other mandatory params.
function __construct($host,$user,$pass,$dbname) {
or may …
2
votes
Accepted
Splitting three comma-delimited strings
you don't need the declaration $deliveryoutcode1 = array();
a for loop is more readable (and it fulfills exactly that purpose)
$rows['deliveryoutcode' . $i . ''] could be $rows['deliveryoutcode' . $i …
10
votes
How much is 2 + 2?
I would:
improve (avoid) the PHP & HTML mixing.
use one associative array instead of two array in order to define the operators
avoid a while. … This syntax could be disabled by .ini configuration if your PHP is <=5.3. In this case you must use the most verbose <?php echo
Another thing about rand. …
0
votes
Validate input of month/year, otherwise set it to current month/year
I would build in both case the DateTime Object and then use always the ->format() method
I would use the short syntax for array (PHP 5.4+ only) [] inestad of array()
then:
$month = filter_input(INPUT_GET …
4
votes
Accepted
Is my login system secure?
Flow Security
You should repeat the email validation in Server side too (js validation could be bypassed)
You don't check if the user is already inserted during sign up. There is no unique key in you …