WS101 - Module 2 - FUNCTIONS AND ARRAYS

Ace your homework & exams now with Quizwiz!

A ______ is a set of program statements that perform a specific task, and that can be called, or executed, from anywhere in your program.

function

The declaration of a user-defined function start with the word _________, followed by the name of the function you want to create followed by parentheses i.e. () and finally place your function's code between curly brackets {}.

function

You can create a function by using keyword _______ and inserting the code in the function block.

function()

if you want to return a value from the function you should need to insert the keyword ________ followed by an expression inside your function. Once the PHP interpreter encounters the ____ keyword from the function this will stops execution of the function and returns expression as the function's value.

return

The function _______ is mostly used in loop counters that the loop iterates as many times as there are elements in the array.

sizeof()

You can declare the variables anywhere in a PHP script. But, the location of the declaration determines the extent of a variable's visibility within the PHP program i.e. where the variable can be used or accessed. This accessibility is known as _________

variable scope

are complex variables that allow us to store more than one value or a group of values under a single variable name

Arrays

— An array where each key has its own specific value. - In an ________, the keys assigned to values can be arbitrary and user defined strings.

Associative array

— An array with a numeric key.

Indexed array

Types of Arrays in PHP

Indexed array Associative array Multidimensional array

— An array containing one or more arrays within itself - is an array of arrays also called nested array

Multidimensional array

- Pop the element off the end ofarray

array_pop()

- Push one or more elements onto the end ofarray

array_push()

- Searches the array for a given value and returns the corresponding key ifsuccessful

array_search()

You can make the variable available by using the keyword ______ that makes a variable available at any location in the program. For

global

By default, variables declared within a function are _____ and they cannot be viewed or manipulated from outside of that function

local variable

You can specify ______ when you define your function to accept input values at run time. -work like placeholder variables within a function; they're replaced at run time by the values (known as argument) provided to the function at the time of invocation.

parameters


Related study sets

NASM 7th ed, Chapter 13: Integrated training and the OPT Model

View Set

NBB 301 Exam 2: Voltage Gated Channels and Action Potentials, NBB 301 Exam 2: Synaptic Transmission, NBB 301 Exam 2: Neurotransmitters and Their Receptors, NBB 301 Exam 2: Postsynaptic Response, NBB 301 Exam 2: Synaptic Plasticity

View Set

System Analysis and Design Final

View Set

3.5 Genetic Modification And Biotechnology

View Set

Geography - Proving Lines Parallel assignment

View Set

U.S. Government Final Exam review

View Set

Response to loss of biodiversity

View Set