Advertisement
oquidave

optional arguments

Jun 27th, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. //call the Increamentcounters() fn
  2. Increamentcounters($IncreamentNavCounter = TRUE);
  3.  
  4. function Increamentcounters($ses_variable='',$IncreamentNavCounter = FALSE){
  5. global $ses_id,$seslog;
  6. $ses_variable = 'ses_counter';
  7. list($ses_counter, $error) = $seslog->SesVarRead($ses_id, $ses_variable);
  8. if ($error == '') {
  9. $ses_value = $ses_counter;
  10. $ses_value++;
  11. $seslog->SesVarUpdate($ses_id, $ses_variable, $ses_value);
  12. if ($IncreamentNavCounter) {
  13. //increament the nav_counter too
  14. $ses_variable = 'nav_counter';
  15. Increamentcounters($ses_variable);
  16. }
  17. return TRUE;
  18. }else {
  19. //we have an error
  20. return FALSE;
  21. }
  22. }//close Increamentcounters() fn
  23.  
  24. //debugger variable values
  25. $ses_variable=(boolean) true
  26. $IncreamentNavCounter = (boolean) false
  27.  
  28. //my qn
  29. am abit surprised by the results, i thought that the $IncreamentNavCounter would be set to true on calling the function while the $ses_variable value remains null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement