I\'m writing code for a sortable table, where clicking the links in the header change the ORDER BY executed when generating a set of search results (the case where there the
The key point is that a switch() statement performs comparisons between the parameter and the labels. That means that you have to deal with PHP comparison and type casting rules. Just see some examples:
The reference can be found at:
Initializing an unset GET parameter to 0 is a pretty strange design decision. You should deal with that particular case in a separate fashion to make it clear that it's a special situation:
if( $name===0 ){
return '';
}
switch($name){
// ...
}