Functions are blocks of code that perform tasks and can be reused. Large projects require functions to organize code and avoid repetition. Functions accept input, process it, and return output. Functions can be built-in to PHP or user-defined. User-defined functions are created using the function keyword and can accept arguments passed by value or reference. Arrays allow storing multiple values and are indexed with keys and values. Arrays can be numerically or associatively indexed.
User-defined functions allow programmers to define reusable blocks of code to perform tasks. Functions are defined using the function keyword followed by a name and parameters. Code within the function body is executed when the function is called. Functions may take arguments, have default values, return values, and be called recursively. Functions can also be defined inside other functions.
Functions in PHP allow programmers to organize code into reusable blocks. There are built-in and user-defined functions. User-defined functions use the function keyword and can accept arguments, return values, and be called elsewhere in the code. Functions can pass arguments by value, where changes inside the function don't affect the original variable, or by reference, where changes are reflected outside the function. Functions can also have default argument values and static variables that retain their value between calls.
This document discusses PHP functions and arrays. It defines PHP functions as reusable pieces of code that can take arguments and return values. There are built-in and user-defined functions. Arrays allow storing multiple values in a single variable. PHP supports indexed, associative, and multidimensional arrays. Indexed arrays use numeric indexes while associative arrays use named keys. Multidimensional arrays store arrays within other arrays, allowing representation of tabular data. Functions and arrays are fundamental PHP concepts that improve code reuse and organization.
This document discusses PHP functions including:
- The syntax and advantages of functions
- Common string, numeric, and date/time functions
- Creating user-defined functions
- Passing arguments to functions
- Returning values from functions
The document provides examples of using built-in PHP functions like strlen(), rand(), date(), and creating user-defined functions that can accept arguments and return values. It also discusses concepts like default arguments and stopping function execution with return.
The document discusses functions in PHP. It defines what a function is and some key properties like having a unique name, performing independent tasks without interfering with other code, and optionally returning values. It provides examples of built-in PHP functions for arrays, characters, and numbers. It also covers user-defined functions, passing arguments by value and reference, variable scopes, and using static variables in functions.
This document discusses PHP functions and arrays. It defines PHP functions as reusable blocks of code that can be called repeatedly using the function name. User-defined functions in PHP start with the "function" keyword. Functions can accept arguments and return values. Arrays allow storing multiple values in a single variable and accessing them via numeric indexes. The document provides examples of creating, accessing, and looping through indexed arrays in PHP code.
This document discusses PHP functions and modularity. It explains why functions are used to organize code and avoid repetition. Built-in PHP functions are powerful, and custom functions can be created by defining them with the function keyword. Functions can take arguments, return values, and be called by reference. Variable scope is also covered, noting that function variables are usually isolated unless declared global. The document demonstrates including other files to split code into multiple files and check for function existence. Overall it provides an overview of functions and modularity in PHP.
This document discusses PHP functions and modularity. It explains why functions are used to organize code and avoid repetition. Built-in PHP functions are powerful, and custom functions can be created by defining them with the function keyword. Functions can take arguments, return values, and be called by reference. Variable scope is also covered, noting that function variables are usually isolated unless declared global. The document demonstrates including other files to split code into multiple files and check for function existence. Overall it provides an overview of functions and modularity in PHP.
This document outlines PHP functions including function declaration, arguments, returning values, variable scope, static variables, recursion, and useful built-in functions. Functions are blocks of code that perform tasks and can take arguments. They are declared with the function keyword followed by the name and parameters. Functions can return values and arguments are passed by value by default but can also be passed by reference. Variable scope inside functions refers to the local scope unless specified as global. Static variables retain their value between function calls. Recursion occurs when a function calls itself. Useful built-in functions include function_exists() and get_defined_functions().
Functions allow programmers to organize and reuse code. PHP has many built-in functions for common string and date/time operations. Programmers can also define their own functions. Functions can accept arguments, use default values, be called by value or reference, and be recursive. Variable scope inside functions prevents naming collisions with external variables. Well-formed PHP functions follow naming conventions and can contain other functions and classes.
why function,built in function,arguments,default arguments,call by value,call by reference,recursive function,variable scope,user defined function,date/time function
php 2 Function creating, calling,PHP built-in functiontumetr1
The document discusses PHP functions, including how to create and call custom functions, and examples of useful built-in PHP functions. It explains that functions allow reusable blocks of code and built-in functions are pre-made and do not need to be created. Examples are provided for creating functions that take parameters and return values, as well as calling functions. Common built-in functions are also described, such as trim(), explode(), implode(), and print_r() which operate on strings and arrays.
This document provides an overview of server-side scripting using PHP. It includes 15 questions covering PHP topics like variables, data types, arrays, functions, and form handling. The questions are worth a total of 15 marks and include multiple choice, fill in the blank, true/false, and code writing questions. The document then provides details on PHP including an introduction, how it is well-suited for web development, examples of first PHP code, and explanations of variables, data types, arrays, control structures, functions and comments.
This document discusses PHP functions and how to define, call, and use them. It covers defining functions, arguments and parameters, default argument values, variable scope, and including library files. Functions allow reusable blocks of code and avoid duplicating code. Arguments are values passed into a function, while parameters are variable names used inside the function. Default arguments can be set so functions still work if not all arguments are passed. Variable scope determines where variables can be accessed. Library files allow storing functions in one place and including them elsewhere.
PHP is a server-side scripting language that can be embedded into HTML. It is used to dynamically generate client-side code sent as the HTTP response. PHP code is executed on the web server and allows variables, conditional statements, loops, functions, and arrays to dynamically output content. Key features include PHP tags <?php ?> to delimit PHP code, the echo command to output to the client, and variables that can store different data types and change types throughout a program.
PHP is a server-side scripting language that can be embedded into HTML. It is used to dynamically generate client-side code sent as the HTTP response. PHP code is executed on the web server and allows variables, conditional statements, loops, functions, and arrays to dynamically output content. Key features include PHP tags <?php ?> to delimit PHP code, the echo command to output to the client, and variables that can store different data types and change types throughout a program.
The document discusses various PHP concepts like operators, comments, if/else statements, loops, functions etc. It provides code examples for each concept. Some key points covered are:
- PHP operators are used to perform operations on operands and can be categorized into arithmetic, bitwise, logical etc.
- Comments can be used to describe code or hide code and PHP supports single line and multi line comments.
- Control structures like if/else, switch are used to execute code conditionally based on tests.
- Loops like for, foreach, while, do-while are used to repeat code.
- Functions allow code reusability and can take arguments to pass input and return output. Functions can also use
This document provides an overview of loops, functions, and dates in PHP. It discusses for loops, using the date() function to output different date formats, and how to declare user-defined functions in PHP with optional arguments and return values. Examples are given for each concept and exercises provided to help reinforce the content.
This document discusses various PHP functions categorized into different groups like:
- Date Functions: date, getdate, setdate, Checkdate, time, mktime
- String Functions: strtolower, strtoupper, strlen, trim, substr, strcmp etc.
- Math Functions: abs, ceil, floor, round, pow, sqrt, rand
- User Defined Functions: functions with arguments, default arguments, returning values
- File Handling Functions: fopen, fread, fwrite, fclose to handle files
- Miscellaneous Functions: define, constant, include, require, header to define constants, include files etc.
This document provides an overview of PHP including:
- Basic PHP syntax like variables, data types, operators, and control structures
- Functions - both built-in and user-defined, including arguments and return values
- Loops - while, do-while, for, foreach
- Object-oriented concepts like classes, objects, constructors, inheritance
- Arrays - indexed, associative, and multidimensional
- Strings and math functions
- An introduction to abstraction and object-oriented programming principles in PHP
To define responsive web design means that your website (and its pages) can adapt and deliver the best experience to users, whether they’re on their desktop, laptop, tablet, or smartphone. For that to happen, though, your website needs a responsive design.
More Related Content
Similar to function in php using like three type of function (20)
This document discusses PHP functions and modularity. It explains why functions are used to organize code and avoid repetition. Built-in PHP functions are powerful, and custom functions can be created by defining them with the function keyword. Functions can take arguments, return values, and be called by reference. Variable scope is also covered, noting that function variables are usually isolated unless declared global. The document demonstrates including other files to split code into multiple files and check for function existence. Overall it provides an overview of functions and modularity in PHP.
This document outlines PHP functions including function declaration, arguments, returning values, variable scope, static variables, recursion, and useful built-in functions. Functions are blocks of code that perform tasks and can take arguments. They are declared with the function keyword followed by the name and parameters. Functions can return values and arguments are passed by value by default but can also be passed by reference. Variable scope inside functions refers to the local scope unless specified as global. Static variables retain their value between function calls. Recursion occurs when a function calls itself. Useful built-in functions include function_exists() and get_defined_functions().
Functions allow programmers to organize and reuse code. PHP has many built-in functions for common string and date/time operations. Programmers can also define their own functions. Functions can accept arguments, use default values, be called by value or reference, and be recursive. Variable scope inside functions prevents naming collisions with external variables. Well-formed PHP functions follow naming conventions and can contain other functions and classes.
why function,built in function,arguments,default arguments,call by value,call by reference,recursive function,variable scope,user defined function,date/time function
php 2 Function creating, calling,PHP built-in functiontumetr1
The document discusses PHP functions, including how to create and call custom functions, and examples of useful built-in PHP functions. It explains that functions allow reusable blocks of code and built-in functions are pre-made and do not need to be created. Examples are provided for creating functions that take parameters and return values, as well as calling functions. Common built-in functions are also described, such as trim(), explode(), implode(), and print_r() which operate on strings and arrays.
This document provides an overview of server-side scripting using PHP. It includes 15 questions covering PHP topics like variables, data types, arrays, functions, and form handling. The questions are worth a total of 15 marks and include multiple choice, fill in the blank, true/false, and code writing questions. The document then provides details on PHP including an introduction, how it is well-suited for web development, examples of first PHP code, and explanations of variables, data types, arrays, control structures, functions and comments.
This document discusses PHP functions and how to define, call, and use them. It covers defining functions, arguments and parameters, default argument values, variable scope, and including library files. Functions allow reusable blocks of code and avoid duplicating code. Arguments are values passed into a function, while parameters are variable names used inside the function. Default arguments can be set so functions still work if not all arguments are passed. Variable scope determines where variables can be accessed. Library files allow storing functions in one place and including them elsewhere.
PHP is a server-side scripting language that can be embedded into HTML. It is used to dynamically generate client-side code sent as the HTTP response. PHP code is executed on the web server and allows variables, conditional statements, loops, functions, and arrays to dynamically output content. Key features include PHP tags <?php ?> to delimit PHP code, the echo command to output to the client, and variables that can store different data types and change types throughout a program.
PHP is a server-side scripting language that can be embedded into HTML. It is used to dynamically generate client-side code sent as the HTTP response. PHP code is executed on the web server and allows variables, conditional statements, loops, functions, and arrays to dynamically output content. Key features include PHP tags <?php ?> to delimit PHP code, the echo command to output to the client, and variables that can store different data types and change types throughout a program.
The document discusses various PHP concepts like operators, comments, if/else statements, loops, functions etc. It provides code examples for each concept. Some key points covered are:
- PHP operators are used to perform operations on operands and can be categorized into arithmetic, bitwise, logical etc.
- Comments can be used to describe code or hide code and PHP supports single line and multi line comments.
- Control structures like if/else, switch are used to execute code conditionally based on tests.
- Loops like for, foreach, while, do-while are used to repeat code.
- Functions allow code reusability and can take arguments to pass input and return output. Functions can also use
This document provides an overview of loops, functions, and dates in PHP. It discusses for loops, using the date() function to output different date formats, and how to declare user-defined functions in PHP with optional arguments and return values. Examples are given for each concept and exercises provided to help reinforce the content.
This document discusses various PHP functions categorized into different groups like:
- Date Functions: date, getdate, setdate, Checkdate, time, mktime
- String Functions: strtolower, strtoupper, strlen, trim, substr, strcmp etc.
- Math Functions: abs, ceil, floor, round, pow, sqrt, rand
- User Defined Functions: functions with arguments, default arguments, returning values
- File Handling Functions: fopen, fread, fwrite, fclose to handle files
- Miscellaneous Functions: define, constant, include, require, header to define constants, include files etc.
This document provides an overview of PHP including:
- Basic PHP syntax like variables, data types, operators, and control structures
- Functions - both built-in and user-defined, including arguments and return values
- Loops - while, do-while, for, foreach
- Object-oriented concepts like classes, objects, constructors, inheritance
- Arrays - indexed, associative, and multidimensional
- Strings and math functions
- An introduction to abstraction and object-oriented programming principles in PHP
To define responsive web design means that your website (and its pages) can adapt and deliver the best experience to users, whether they’re on their desktop, laptop, tablet, or smartphone. For that to happen, though, your website needs a responsive design.
software evelopment life cycle model and example of water fall modelvishal choudhary
studying the existing or obsolete system and software,
conducting interviews of users and developers,
referring to the database or
collecting answers from the questionnaires.
software Engineering lecture on development life cyclevishal choudhary
SDLC starts from the moment, when it’s made a decision to launch the project.
There is no one single SDLC model.
They are divided into groups,
Each with its features and weaknesses
The document provides an introduction to software engineering. It defines software engineering as an engineering discipline concerned with all aspects of software production. It discusses why software engineering is important given that errors in complex software systems can have devastating consequences, as shown through examples of software failures in air traffic control, satellite launches, and ambulance dispatch systems. The document also covers fundamental software engineering concepts like the software process, process models, and costs.
The document discusses software testing concepts like validation testing vs defect testing, system and component testing strategies, and test automation tools. It defines key terms like bugs, defects, errors, faults, and failures. It also describes techniques like equivalence partitioning and boundary value analysis that are used to generate test cases that thoroughly test software. Component testing tests individual program parts while system testing tests integrated groups of components. Test cases specify conditions to determine if software works as intended.
How to Use Owl Slots in Odoo 17 - Odoo SlidesCeline George
In this slide, we will explore Owl Slots, a powerful feature of the Odoo 17 web framework that allows us to create reusable and customizable user interfaces. We will learn how to define slots in parent components, use them in child components, and leverage their capabilities to build dynamic and flexible UIs.
How to Create Time Off Request in Odoo 18 Time OffCeline George
Odoo 18 provides an efficient way to manage employee leave through the Time Off module. Employees can easily submit requests, and managers can approve or reject them based on company policies.
POS Reporting in Odoo 18 - Odoo 18 SlidesCeline George
To view all the available reports in Point of Sale, navigate to Point of Sale > Reporting. In this section, you will find detailed reports such as the Orders Report, Sales Details Report, and Session Report, as shown below.
Order: Odonata Isoptera and Thysanoptera.pptxArshad Shaikh
*Odonata*: Odonata is an order of insects that includes dragonflies and damselflies. Characterized by their large, compound eyes and agile flight, they are predators that feed on other insects, playing a crucial role in maintaining ecological balance.
*Isoptera*: Isoptera is an order of social insects commonly known as termites. These eusocial creatures live in colonies with complex social hierarchies and are known for their ability to decompose wood and other cellulose-based materials, playing a significant role in ecosystem nutrient cycling.
*Thysanoptera*: Thysanoptera, or thrips, are tiny insects with fringed wings. Many species are pests that feed on plant sap, transmitting plant viruses and causing damage to crops and ornamental plants. Despite their small size, they have significant impacts on agriculture and horticulture.
The PDF titled "Critical Thinking and Bias" by Jibi Moses aims to equip a diverse audience from South Sudan with the knowledge and skills necessary to identify and challenge biases and stereotypes. It focuses on developing critical thinking abilities and promoting inclusive attitudes to foster a more cohesive and just society. It defines bias as a tendency or prejudice affecting perception and interactions, categorizing it into conscious and unconscious (implicit) biases. The content highlights the impact of societal and cultural conditioning on these biases, particularly within the South Sudanese context.
Stewart Butler - OECD - How to design and deliver higher technical education ...EduSkills OECD
Stewart Butler, Labour Market Economist at the OECD presents at the webinar 'How to design and deliver higher technical education to develop in-demand skills' on 3 June 2025. You can check out the webinar recording via our website - https://oecdedutoday.com/webinars/ .
You can check out the Higher Technical Education in England report via this link 👉 - https://www.oecd.org/en/publications/higher-technical-education-in-england-united-kingdom_7c00dff7-en.html
You can check out the pathways to professions report here 👉 https://www.oecd.org/en/publications/pathways-to-professions_a81152f4-en.html
"Dictyoptera: The Order of Cockroaches and Mantises" Or, more specifically: ...Arshad Shaikh
Dictyoptera is an order of insects that includes cockroaches and praying mantises. These insects are characterized by their flat, oval-shaped bodies and unique features such as modified forelegs in mantises for predation. They inhabit diverse environments worldwide.
Happy Summer Everyone. This is also timeless for future viewing.
You all have been upgraded from ‘Guest’ Students to ‘Graduate’ Students. Do Welcome Back. For new guests, please see our free weekly workshops from Spring ‘25’
Blessings, Love, and Namaste’.
Do Welcome to Summer ‘25’ for LDMMIA.
TY, for surviving our First Season/Term of our Reiki Yoga Workshops. These presentations/workshop are designed for your energy wellness.
Also, professional expansion for Summer ‘25’. All updates will be uploaded here and digital notes within our Merch Shop. (I am Completely, using the suggestions of AI for my Biz style. Its spooky accurate. So far, AI has been very helpful for office and studio admin. I even updated my AI avatars. Similar to my SL Meta avatar.)
Do take Care of yourselves. This is only a Bonus Checkin. The Next Workshop will be Lecture/Session 8. I will complete by Friday.
https://ldm-mia.creator-spring.com/
Pragya Champion's Chalice is the annual Intra Pragya General Quiz hosted by the club's outgoing President and Vice President. The prelims and finals are both given in the singular set.
Introduction to Online CME for Nurse Practitioners.pdfCME4Life
Online CME for nurse practitioners provides a flexible, cost-effective way to stay current with evidence-based practices and earn required credits without interrupting clinical duties. Accredited platforms offer a wide range of self-paced courses—complete with interactive case studies, downloadable resources, and immediate digital certificates—that fit around demanding schedules. By choosing trusted providers, practitioners gain in-depth knowledge on emerging treatments, refine diagnostic and patient-management skills, and build professional credibility. Know more at https://cme4life.com/the-benefits-of-online-cme-for-nurse-practitioners/
"Hymenoptera: A Diverse and Fascinating Order".pptxArshad Shaikh
Hymenoptera is a diverse order of insects that includes bees, wasps, ants, and sawflies. Characterized by their narrow waists and often social behavior, Hymenoptera play crucial roles in ecosystems as pollinators, predators, and decomposers, with many species exhibiting complex social structures and communication systems.
How to Setup Renewal of Subscription in Odoo 18Celine George
A subscription is a recurring plan where you set a subscription period, such as weekly, monthly, or yearly. Based on this period, the subscription renews automatically. In Odoo 18, you have the flexibility to manage renewals either manually or automatically.
Prottutponnomotittwa: A Quiz That Echoed the Pulse of Bengal
On the 31st of May, 2025, PRAGYA – The Official Quiz Club of UEM Kolkata – did not merely organize another quiz. It hosted an ode to Bengal — its people, its quirks, its politics, its art, its rebellion, its heritage. Titled Prottutponnomotittwa, the quiz stood as a metaphor for what Bengal truly is: sharp, intuitive, spontaneous, reflective. A cultural cosmos that thrives on instinct, memory, and emotion.
From the very first slide, it became clear — this wasn’t a quiz made to showcase difficulty or elitism. It was crafted with love — love for Bangla, for its past, present, and its ever-persistent contradictions.
The diversity of the answer list tells the real story of the quiz. The curation was not random. Each answer was a string on a veena of cultural resonance.
In the “Cultural Pairings” round, Anusheh Anadil and Arnob were placed not just as musicians, but as voices of a modern, cross-border Bangla. Their works, which blend baul, jazz, and urban folk, show how Bengal exists simultaneously in Dhaka and Shantiniketan.
The inclusion of Ritwik Chakraborty and Srijit Mukherjee (as a songwriter) showed how the quiz masters understood evolution. Bangla cinema isn’t frozen in the Ray-Ghatak past. It lives, argues, breaks molds — just like these men do.
From Kalyani Black Label to Radhunipagol Chal, consumer culture too had its place. One is liquid courage, the other culinary madness — both deeply Bengali.
The heart truly swelled when the answers touched upon Baidyanath Bhattacharya and Chandril. Both satirists, both sharp, both essential. It was not just about naming them — it was about understanding what different types of literature means in a Bengali context.
Titumir — the play about a peasant rebel who built his own bamboo fort and dared to challenge the British.
Krishnananda Agamvagisha — the mystical Tantric who shaped how we understand esoteric Bengali spiritualism.
Subhas Chandra Bose — the eternal enigma, the braveheart whose shadow looms large over Bengal’s political psyche.
Probashe Ghorkonna — a story lived by many Bengalis. The medinipur daughter, who made a wholesome family, not only in bengal, but across the borders. This answer wasn’t just information. It was emotion.
By the end, what lingered was not the scoreboard. It was a feeling.
The feeling of sitting in a room where Chalchitro meets Chabiwala, where Jamai Shosthi shares the stage with Gayatri Spivak, where Bhupen Hazarika sings with Hemanga Biswas, and where Alimuddin Road and Webskitters occupy the same mental map.
You don’t just remember questions from this quiz.
You remember how it made you feel.
You remember smiling at Keet Keet, nodding at Prabuddha Dasgupta, getting goosebumps at the mention of Bose, and tearing up quietly when someone got Radhunipagol Chal right.
This wasn’t a quiz.
This was an emotional ride of Bangaliyana.
This was — and will remain — Prottutponnomotittwa.
Active Surveillance For Localized Prostate Cancer A New Paradigm For Clinical...wygalkelceqg
Active Surveillance For Localized Prostate Cancer A New Paradigm For Clinical Management 2nd Ed Klotz
Active Surveillance For Localized Prostate Cancer A New Paradigm For Clinical Management 2nd Ed Klotz
Active Surveillance For Localized Prostate Cancer A New Paradigm For Clinical Management 2nd Ed Klotz
Updated About Me. Used for former college assignments.
Make sure to catch our weekly updates. Updates are done Thursday to Fridays or its a holiday/event weekend.
Thanks again, Readers, Guest Students, and Loyalz/teams.
This profile is older. I started at the beginning of my HQ journey online. It was recommended by AI. AI was very selective but fits my ecourse style. I am media flexible depending on the course platform. More information below.
AI Overview:
“LDMMIA Reiki Yoga refers to a specific program of free online workshops focused on integrating Reiki energy healing techniques with yoga practices. These workshops are led by Leslie M. Moore, also known as LDMMIA, and are designed for all levels, from beginners to those seeking to review their practice. The sessions explore various themes like "Matrix," "Alice in Wonderland," and "Goddess," focusing on self-discovery, inner healing, and shifting personal realities.”
2. What is a Function in PHP
• A Function in PHP is a reusable piece or block of code that
performs a specific action.
4. Create a User Defined Function in PHP
A user-defined function declaration starts with the word function:
6. PHP User Defined Functions
Besides the built-in PHP functions, it is possible to create your own functions.
•A function is a block of statements that can be used repeatedly in a
program.
•A function will not execute automatically when a page loads.
•A function will be executed by a call to the function.
7. Why use Functions?
•Better code organization – PHP functions allow us to group blocks of
related code that perform a specific task together.
•Reusability – once defined, a function can be called by a number of scripts
in our PHP files. This saves us time of reinventing the wheel when we want
to perform some routine tasks such as connecting to the database
•Easy maintenance- updates to the system only need to be made in one
place.
9. Advantage of PHP Functions
Code Reusability: PHP functions are defined only once and can be invoked
many times, like in other programming languages.
Less Code: It saves a lot of code because you don't need to write the logic
many times. By the use of function, you can write the logic only once and
reuse it.
Easy to understand: PHP functions separate the programming logic. So it
is easier to understand the flow of the application because every logic is
divided in the form of functions.
11. PHP Function Arguments
• Information can be passed to functions through arguments. An
argument is just like a variable.
• Arguments are specified after the function name, inside the
parentheses. You can add as many arguments as you want, just
separate them with a comma.
20. PHP strict typing
• In this example, the add() function
accepts two integers and returns the
sum of them.
• However, when you pass two floats
1.5 and 2.5, the add() function
returns 3 because PHP implicitly
coerces the values to the target types
by default.
• In this case, PHP coerces the floats
into integers.
• To enable strict typing, you can use
the declare (strict_types=1); directive
at the beginning of the file.
21. • To enable strict typing, you can use the declare(strict_types=1);
• By adding the strict typing directive to the file, the code will
execute in the strict mode. PHP enables the strict mode on a
per-file basis.
• In the strict mode, PHP expects the values with the type
matching with the target types. If there’s a mismatch, PHP will
issue an error.
26. Parameter passing to Functions
PHP allows us two ways in which an argument can be passed into a function:
•Pass by Value: On passing arguments using pass by value, the value of the
argument gets changed within a function, but the original value outside the
function remains unchanged. That means a duplicate of the original value is
passed as an argument.
•Pass by Reference: On passing arguments as pass by reference, the original
value is passed. Therefore, the original value gets altered. In pass by reference we
actually pass the address of the value, where it is stored using ampersand
sign(&).
38. PHP Default Parameters
• The following defines the concat() function that concatenates two strings
with a delimiter:
39. • -PHP allows you to specify a default argument for a parameter.
For example:
• In this example, the $delimiter parameter takes the space as
the default argument.
40. PHP Anonymous Functions
• When you define a function, you specify a name for it. Later, you can call the
function by its name.
• For example, to define a function that multiplies two numbers, you
can do it as follows:
41. • An anonymous function is a function that doesn’t have a name.
• The following example defines an anonymous function that
multiplies two numbers:
42. 1. Code to generate factorial of a number using recursive function in PHP.
TRY THIS
2. Write a program to print numbers from 10 to 1 using the
recursion function.