Advertisement
techcws

Untitled

Sep 21st, 2023
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2. // Name:
  3. // Aim:
  4. // Date:
  5. // En.No:
  6. // PC No:
  7.  
  8. $globalVariable = 10;
  9.  
  10. function AirthOperation($localVariable) {
  11.     global $globalVariable;
  12.    
  13.     $sum = $localVariable + $globalVariable;
  14.     $subtraction = $localVariable - $globalVariable;
  15.     $division = $localVariable / $globalVariable;
  16.     $modulus = $localVariable % $globalVariable;
  17.     $multiplication = $localVariable * $globalVariable;
  18.    
  19.     echo "Sum: $sum<br>";
  20.     echo "Subtraction: $subtraction<br>";
  21.     echo "Division: $division<br>";
  22.     echo "Modulus: $modulus<br>";
  23.     echo "Multiplication: $multiplication<br>";
  24.    
  25.     $GLOBALS['sumValue'] = $sum;
  26. }
  27.  
  28. function IncDecOperation() {
  29.     global $globalVariable;
  30.    
  31.     $preIncrement = ++$globalVariable;
  32.     $preDecrement = --$globalVariable;
  33.     $postIncrement = $globalVariable++;
  34.     $postDecrement = $globalVariable--;
  35.    
  36.     echo "Pre-Increment: $preIncrement<br>";
  37.     echo "Pre-Decrement: $preDecrement<br>";
  38.     echo "Post-Increment: $postIncrement<br>";
  39.     echo "Post-Decrement: $postDecrement<br>";
  40. }
  41.  
  42. function stringconcat($string1, $string2) {
  43.     $output = $string1 . ' ' . $string2;
  44.     echo "Concatenated String: $output<br>";
  45. }
  46.  
  47. AirthOperation(5);
  48. IncDecOperation();
  49. stringconcat("php", "with mysql");
  50.  
  51. echo "Sum Value using reference variable: {$GLOBALS['sumValue']}<br>";
  52.  
  53. $variable = "PHP";
  54. echo 'Single Quotes: $variable<br>';
  55. echo "Double Quotes: $variable<br>";
  56. ?>
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement