Search
 
SCRIPT & CODE EXAMPLE
 

PHP

create function parameters php

<?php
  #Syntax:
  function functionName() {
    code to be executed;
  }

  function Greetings() {
    echo "Hello, welcome!";
  }
  
  Greetings(); #Execute function 

  #Function arguements

  #Function arguements are just like prefixes/suffixes and can have multiple arguements

  function Polygon(str $prefix = penta, str $suffix = gon) {
    echo "$prefix$suffix"
  }

  Polygon("tetra", "gon");
  Polygon(); #Here, we use default value
  Polygon("hexa", "gon");
  Polygon("septa", "gon");
?>
Comment

php functions parameters

// functions require 'function' keyword
// separate the parameters with a comma
function addFunction($num1, $num2) {
	$sum = $num1 + $num2;
	echo "Sum of the two numbers is : $sum";
}

addFunction(1, 2); // echoes: Sum of the two numbers is : 3
Comment

PREVIOUS NEXT
Code Example
Php :: php if else wordpress 
Php :: laravel image path 
Php :: laravel duplicate row 
Php :: check if object has method php 
Php :: PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes") 
Php :: number_format reverse php 
Php :: multiple search filter in laravel 
Php :: cut long text laravel blade 
Php :: laravel date format 
Php :: php hello world 
Php :: php convert string to boolean 
Php :: laravel routes resource 
Php :: laravel event generate 
Php :: laravel take value from different array by key 
Php :: laravel validation regex 
Php :: How to JSON encode a PHP array 
Php :: php exponential operator 
Php :: get post php 
Php :: php session name 
Php :: Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 
Php :: read csv file in php 
Php :: How to get the current taxonomy term ID (not the slug) in WordPress? 
Php :: array constant in php 
Php :: laravel htaccess 
Php :: create if not exist laravel 
Php :: timestamp php 
Php :: emergency password reset script wordpress 
Php :: target class admin homecontroller does not exist laravel 8 
Php :: implode array keys in php 
Php :: php strtotime plus 1 day 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =