Bifalgorithm post · Computer science one · Organizing Functions

How do you call a PHP function with values or variables?

How do you call a PHP function with values or variables? (Computer science one · Organizing Functions) — "40.1.3. Calling Functions The syntax for calling a fu…

Ideas in this flowchart

  • Calling a function
  • The function name is followed by parentheses.
  • The parentheses contain values or variables passed to the function.
  • Examples of function calls
  • sum($a, $b) uses variables and assigns the result 30 to $c.
  • getDistance(0.0, 0.0, 10.0, 20.0) uses literal values.
  • getMonthlyPayment($p, $r, 60) combines variables with the literal value 60.
Feed/

How do you call a PHP function with values or variables?

No cover

Channel

Computer science one

1 page

"40.1.3. Calling Functions The syntax for calling a function is to simply provide the function name followed by parentheses containing values or variables to pass to the function. Some examples:\n\n1 $a = 10, $b = 20;\n\n2 $c = sum($a, $b); //c contains the value 30\n\n3\n\n4 //invoke a function with literal values:\n\n5 $dist = getDistance(0.0, 0.0, 10.0, 20.0);\n\n6\n\n7 //invoke a function with a combination:\n\n8 $p = 1500.0;\n\n9 $r = 0.05;\n\n10 $monthlyPayment = getMonthlyPayment($p, $r, 60);"

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.