Functions
A function is a fragment of code that is written once and then used as many times as required.
Before using a function, you need to declare it using the function keyword. Indicate the function name after it. It must begin with a Latin character or underscore.
Parentheses are written after the function name, and then the function body is written in curly braces. The function body contains the code that the function will execute.
function my_func() {
muffin_log('I am the my_func function');
}
When a function is declared, PHP will remember it, but the code inside the curly braces is not executed. You need to call the function in order to execute it.
Write the function name and a set of parentheses in order to call the function.
my_func(); // Outputs: "I am the my_func function"
The function can be called any number of times.
The variables that are declared inside the function are available only from within this function. And external variables, on the contrary, cannot be seen inside the function. This is called the scope. You can read more about it in the documentation.
We can call one function inside another.
Function arguments
Arguments allow you to pass different kinds of data to functions and to influence what it outputs. Argument are indicated in parentheses when declaring a function. You can include as many arguments as you would like. If there are several arguments, they are separated by commas.
Arguments are similar to variables. They also store values, and their names must begin with a dollar sign. Arguments can only be used in the body of a function.
function my_func($number_1, $number_2) {
muffin_log($number_1 - $number_2);
}
Argument values are specified in parentheses when the function is called. They are listed in a comma-separated list in the same order as their respective arguments when declaring a function.
my_func(3, 1); // Outputs: "2"
my_func(1, 3); // Outputs: "-2"
Functions Return Values
Functions are not only able to accept data, but they can also return it. In order to indicate what value a function should return, the keyword return should be used:
function my_func($number_1, $number_2) {
return $number_1 - $number_2;
}
When a function is called, the value that it returns will take the place of the function in the code.
<!-- Display the function in the template -->
<p><?= my_func(3, 1) ?></p>
<!-- Result -->
<p>2</p>
The function will finish executing after it returns the value. PHP will ignore the subsequent code in the body of the function.
function my_func($number_1, $number_2) {
return $number_1 - $number_2;
// The code on the next line will never be executed
muffin_log('Is there life after a return?');
}
The function may return nothing or just one of the following values: a number, line, array, etc.
Built-in Functions
Built-in functions are the functions that were created by the creators of PHP. They form part of the language, and for that reason they do not need to be declared before you can use them. PHP contains thousands of predefined functions. There is no need to memorize them. After all, you can always look them up in the documentation.
We call a function that is passed as an argument to another function a callback. Callbacks are not built-in functions, since they are created by developers themselves.
uasort
The uasort is one of the built-in functions for sorting an array. This function accepts two arguments: the array that needs to be sorted and the name of the callback function.
uasort($array, 'callback');
The callback function that we pass to uasort has to take two arguments and then return a number: a positive number if the first argument is larger, a negative number if the second argument is greater, or zero if the arguments are equal in value.
When uasort is called, it passes two array elements to the callback, and it is able to determine which one is larger. It then sorts the array in ascending order from smallest to largest element.
array_slice
The array_slice function accepts an array, copies part of it, and returns it as a new array. The array that is passed as an argument to the function (the source array) is unchanged.
The function accepts four arguments:
- The source array,
- The element serial number from which the copying starts,
- The number of elements that need to be copied.
- The boolean value that determines whether the source array keys need to be saved into the new array.
$new_array = array_slice($array, $first_element, $length, $preserve_keys);
array_filter
PHP has a built-in filtering function: array_filter. It takes two arguments (the original array and the callback function) and returns a new array. The source array does not change.
$filtered_array = array_filter($array, 'callback');
According to the documentation, the callback must accept a source array element and return a boolean value of: true if this element should be included in the new array or false if this is not necessary.
array_rand
Use the array_rand function to obtain random elements from the array. It takes the source array and the number of random elements that we want to receive.
$random = array_rand($array, $number_of_elements);
If the second argument is one, then the function will return one random key. If the second argument is greater than one, then the function will return an array with random keys.
The array_rand function is responsible for choosing random elements, but it returns them in the order in which they have been entered in the source array.
shuffle
The shuffle built-in function shuffles the array. The function takes an array and arranges its elements in random order. Be careful, since the shuffle function changes the array that is transmitted to it and does not save the keys. It is best not to use it with associative arrays.
shuffle($array);
Combining Arrays
In PHP you can combine arrays using a plus sign.
$big_array = $array_1 + $array_2;
As a result we get a single array that includes elements from both the first as well as the second arrays. The order of the elements and their keys are saved.
If several elements have the same keys, then the value will be taken from the array that comes first. Before you combine them, make sure that the keys in the arrays are not the same or that the identical values are not assigned to identical keys.
Continue
<!DOCTYPE html><html lang="en" class="no-js"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><script>var b=document.documentElement.classList;b.remove('no-js');if(!window.Promise||!window.sessionStorage||!!sessionStorage.getItem('muller.v2')){b.add('muller')}</script><link rel="dns-prefetch" href="https://assets.htmlacademy.org"><script async src="https://www.googletagmanager.com/gtag/js?id=G-MXPCRXM48C"></script><script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MXPCRXM48C');
</script><script type="text/javascript">
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript"
;r.integrity="sha384-d/yhnowERvm+7eCU79T/bYjOiMmq4F11ElWYLmt0ktvYEVgqLDazh4+gW9CKMpYW"
;r.crossOrigin="anonymous";r.async=true
;r.src="https://cdn.amplitude.com/libs/amplitude-5.2.2-min.gz.js"
;r.onload=function(){if(!e.amplitude.runQueuedFunctions){
console.log("[Amplitude] Error: could not load SDK")}}
;var i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)
;function s(e,t){e.prototype[t]=function(){
this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));return this}}
var o=function(){this._q=[];return this}
;var a=["add","append","clearAll","prepend","set","setOnce","unset"]
;for(var u=0;u<a.length;u++){s(o,a[u])}n.Identify=o;var c=function(){this._q=[]
;return this}
;var l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"]
;for(var p=0;p<l.length;p++){s(c,l[p])}n.Revenue=c
;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"]
;function v(e){function t(t){e[t]=function(){
e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}
for(var n=0;n<d.length;n++){t(d[n])}}v(n);n.getInstance=function(e){
e=(!e||e.length===0?"$default_instance":e).toLowerCase()
;if(!n._iq.hasOwnProperty(e)){n._iq[e]={_q:[]};v(n._iq[e])}return n._iq[e]}
;e.amplitude=n})(window,document);
amplitude.getInstance().init("df11525b6880a3c5e2af14f9b6238408", null,{
includeUtm: true,
includeGclid: true,
includeReferrer: true,
deviceIdFromUrlParam: true
}, function (instance) {
window.amplitudeLoaded = true;
});
</script><link rel="stylesheet" href="https://assets.htmlacademy.org/css/core.v284.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/profile.v236.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course.v246.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-light.v20.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-en.v2.css"><script src="https://assets.htmlacademy.org/js/sentry.js" data-sentry="3774884cc81746ed84c0ba7c5cd4ac7b" data-project="26" data-version="2"></script><link rel="stylesheet" href="/css/custom.css"><link rel="stylesheet" href="/css/cookies.css"><link rel="preload" as="script" href="https://assets.htmlacademy.org/js/general.v274.js"><title>Summary of “Arrays and functions in PHP” — Arrays and functions in PHP — HTML Academy</title><meta name="csrf-token" content="55564caf322823086fca37a7326b9bd2a54"><meta property="og:type" content="website"><meta property="og:site_name" content="HTML Academy"><meta name="twitter:url" property="og:url" content="https://htmlacademy.org"><meta name="twitter:title" property="og:title" content="Interactive online courses HTML Academy"><meta name="twitter:description" property="og:description" content="Together we’ll learn how to work with real code, solve true-to-life problems, use cutting edge technologies. Minimum of boring theory and lots of practical tasks."><meta name="twitter:image" property="og:image" content="https://htmlacademy.org/og/htmlacademy.png"><meta name="twitter:card" content="summary_large_image"><link rel="canonical" href="https://htmlacademy.org/courses/php-basics/php-arrays-functions/summary"><meta name="theme-color" content="#2f358f"></head><body class="course-interface course-interface--light course-interface--full" data-base="/assets/courses/29/"><header class="page-header page-header--course"><div class="page-header__inner"><div class="page-header__top"><a class="page-header__logo" href="/" aria-label="HTML Academy Home"><img src="https://assets.htmlacademy.org/img/logo--small.svg?cs=1218aec0be4a5f23db79ad29a14e30f7f9fb9a25" width="24" height="36" alt="HTML Academy"></a><nav class="main-nav main-nav--mini" role="navigation"><div class="main-nav__course-nav"><a class="main-nav__course-item main-nav__course-button main-nav__course-button--prev" href="/courses/php-basics/php-arrays-functions/shuffle-function">The shuffle function and shuffling the array</a><div class="main-nav__course-item main-nav__course-list main-nav__course-list--collapsed"><b class="main-nav__course-title">Arrays and functions in PHP</b><span class="main-nav__course-stat">17/17</span><div class="main-nav__course-contents"><a class="main-nav__course-contents-link" href="/courses/php-basics/php-arrays-functions">Back to the list of tasks</a><ul class="main-nav__course-contents-list"><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/display-products">1. Display all of the products from the order on the page</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/declare-call-function">2. Declare and call the function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/function-argiments">3. Function arguments</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/function-return-value">4. Functions return values</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/product-id-function">5. Passing the product ID to the function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/calculate-shipping-cost">6. Calculating the shipping cost</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/optimize-function">7. Optimizing the function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/built-in-function">8. Built-in functions</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/uasort-function">9. The uasort function and sorting products</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/change-sorting-direction">10. Changing the sorting direction</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/array-slice-function">11. The array_slice function and retrieving part of an array</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/new-products">12. Determining which products are new arrivals</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/array-filter-function">13. The array_filter function and filtering the array</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/combine-arrays">14. Combining the arrays</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/array-rand-function">15. The array_rand function and obtaining random elements</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-arrays-functions/shuffle-function">16. The shuffle function and shuffling the array</a></li><li class="main-nav__course-contents-item main-nav__course-contents-item--current"><a href="/courses/php-basics/php-arrays-functions/summary">17. Summary of “Arrays and functions in PHP”</a></li></ul></div></div><a class="main-nav__course-item main-nav__course-button main-nav__course-button--next" href="/courses/php-basics/php-arrays-functions">List of tasks</a></div><ul class="main-nav__list main-nav__list--user main-nav__list--user-guest"><li class="main-nav__item" itemprop="name"><a class="main-nav__link" href="/signup?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" title="Sign up" data-modal="open" data-value="register" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#user"></use></svg></span>Sign up</a></li><li class="main-nav__item main-nav__item--login" itemprop="name"><a class="main-nav__link" href="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" title="Log in" data-modal="open" data-value="login" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#login"></use></svg></span>Log in</a></li></ul></nav></div></div></header><main class="course-container"><div class="course-theory"><div class="course-theory__inner"><section class="course-theory__content"><h1 class="course-theory__content-heading course-theory__content-heading--synopsis">Summary of “Arrays and functions in PHP”</h1><div class="course-theory__content-text"><h2>Functions</h2><p>A <b>function</b> is a fragment of code that is written once and then used as many times as required.</p><p>Before using a function, you need to <i>declare</i> it using the <code>function</code> keyword. Indicate the function name after it. It must begin with a Latin character or underscore.</p><p>Parentheses are written after the function name, and then the function body is written in curly braces. The function body contains the code that the function will execute.</p><pre><code><mark>function</mark> my_func() {
muffin_log('I am the my_func function');
}</code></pre><p>When a function is declared, PHP will remember it, but the code inside the curly braces is not executed. You need to <i>call</i> the function in order to execute it.</p><p>Write the function name and a set of parentheses in order to call the function.</p><pre><code>my_func(); // Outputs: "I am the my_func function"</code></pre><p>The function can be called any number of times.</p><p>The variables that are declared inside the function are available only from within this function. And external variables, on the contrary, cannot be seen inside the function. This is called the scope. You can read more about it in the <a href="https://www.php.net/manual/en/language.variables.scope.php" target="_blank" rel="nofollow noopener">documentation</a>.</p><p>We can call one function inside another.</p><h2>Function arguments</h2><p>Arguments allow you to pass different kinds of data to functions and to influence what it outputs. Argument are indicated in parentheses when declaring a function. You can include as many arguments as you would like. If there are several arguments, they are separated by commas.</p><p>Arguments are similar to variables. They also store values, and their names must begin with a dollar sign. Arguments can only be used in the body of a function.</p><pre><code>function my_func(<mark>$number_1, $number_2</mark>) {
muffin_log($number_1 - $number_2);
}</code></pre><p>Argument values are specified in parentheses when the function is called. They are listed in a comma-separated list <b>in the same order</b> as their respective arguments when declaring a function.</p><pre><code>my_func(3, 1); // Outputs: "2"
my_func(1, 3); // Outputs: "-2"</code></pre><h2>Functions Return Values</h2><p>Functions are not only able to accept data, but they can also <b>return</b> it. In order to indicate what value a function should return, the keyword <code>return</code> should be used:</p><pre><code>function my_func($number_1, $number_2) {
<mark>return</mark> $number_1 - $number_2;
}</code></pre><p>When a function is called, the value that it returns will take the place of the function in the code.</p><pre><code><!-- Display the function in the template -->
<p><?= my_func(3, 1) ?></p>
<!-- Result -->
<p>2</p></code></pre><p>The function will finish executing after it returns the value. PHP will ignore the subsequent code <b>in the body</b> of the function.</p><pre><code>function my_func($number_1, $number_2) {
return $number_1 - $number_2;
// The code on the next line will never be executed
muffin_log('Is there life after a return?');
}</code></pre><p>The function may return nothing or just <b>one</b> of the following values: a number, line, array, etc.</p><h2>Built-in Functions</h2><p><b>Built-in functions</b> are the functions that were created by the creators of PHP. They form part of the language, and for that reason they do not need to be declared before you can use them. PHP contains thousands of predefined functions. There is no need to memorize them. After all, you can always look them up in <a href="https://www.php.net/manual/en/funcref.php" target="_blank" rel="nofollow noopener">the documentation</a>.</p><p>We call a function that is passed as an argument to another function a <b>callback</b>. Callbacks are not built-in functions, since they are created by developers themselves.</p><h3>uasort</h3><p>The <code>uasort</code> is one of the built-in functions for sorting an array. This function accepts two arguments: the array that needs to be sorted and the name of the callback function.</p><pre><code>uasort($array, 'callback');</code></pre><p>The callback function that we pass to <code>uasort</code> has to take two arguments and then return a number: a positive number if the first argument is larger, a negative number if the second argument is greater, or zero if the arguments are equal in value.</p><p>When <code>uasort</code> is called, it passes two array elements to the callback, and it is able to determine which one is larger. It then sorts the array in ascending order from smallest to largest element.</p><h3>array_slice</h3><p>The <code class="nowrap">array_slice</code> function accepts an array, copies part of it, and returns it as a new array. The array that is passed as an argument to the function (the source array) is unchanged.</p><p>The function accepts four arguments:</p><ul><li>The source array,</li><li>The element serial number from which the copying starts,</li><li>The number of elements that need to be copied.</li><li>The boolean value that determines whether the source array keys need to be saved into the new array.</li></ul><pre><code>$new_array = <mark>array_slice</mark>($array, $first_element, $length, $preserve_keys);</code></pre><h3>array_filter</h3><p>PHP has a built-in filtering function: <code class="nowrap">array_filter</code>. It takes two arguments (the original array and the callback function) and returns a new array. The source array does not change.</p><pre><code>$filtered_array = <mark>array_filter</mark>($array, 'callback');</code></pre><p>According to <a href="https://www.php.net/manual/en/function.array-filter.php" target="_blank" rel="nofollow noopener">the documentation</a>, the callback must accept a source array element and return a boolean value of: <code>true</code> if this element should be included in the new array or <code>false</code> if this is not necessary.</p><h3>array_rand</h3><p>Use the <code class="nowrap">array_rand</code> function to obtain random elements from the array. It takes the source array and the number of random elements that we want to receive.</p><pre><code>$random = <mark>array_rand</mark>($array, $number_of_elements);</code></pre><p>If the second argument is one, then the function will return one random key. If the second argument is greater than one, then the function will return an array with random keys.</p><p>The <code class="nowrap">array_rand</code> function is responsible for choosing random elements, but it returns them in the order in which they have been entered in the source array.</p><h3>shuffle</h3><p>The <code>shuffle</code> built-in function shuffles the array. The function takes an array and arranges its elements in random order. Be careful, since the <code>shuffle</code> function changes the array that is transmitted to it and does not save the keys. It is best not to use it with associative arrays.</p><pre><code>shuffle($array);</code></pre><h2>Combining Arrays</h2><p>In PHP you can combine arrays using a plus sign.</p><pre><code>$big_array = $array_1 <mark>+</mark> $array_2;</code></pre><p>As a result we get a single array that includes elements from both the first as well as the second arrays. The order of the elements and their keys are saved.</p><p>If several elements have the same keys, then the value will be taken from the array that comes first. Before you combine them, make sure that the keys in the arrays are not the same or that the identical values are not assigned to identical keys.</p><br><a class="button button--green button--large button--wide button--icon" href="/courses/php-basics/php-arrays-functions"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#icon-check-bold"></use></svg>
Continue
</a></div></section></div></div><script
src="https://assets.htmlacademy.org/scripts/courses-spa/htmlacademy-task.v43.js"
data-assets-path="https://assets.htmlacademy.org/scripts/courses-spa/"
data-task-type="theory"
data-lang="en"
></script><script>HtmlacademyTask.setup(function(){});</script></main><footer class="page-footer page-footer--tiny"><div class="page-footer__inner"><p><a href="/docs/cookies">Cookies</a> ∙
<a href="/docs/privacy">Privacy</a> ∙
<a href="/docs/agreement">License Agreement</a> ∙
<a href="/docs/about">About</a> ∙
<a href="/contacts">Contacts</a> ∙
© HTML Academy OÜ, 2019−2026
</p><div class="page-footer__financial"><img src="https://assets.htmlacademy.org/img/visa-white.svg?cs=96e54ec8c587db9d4b1d8d328ffd87c2ebfd9555" alt="VISA" title="VISA" width="35" height="35"><img src="https://assets.htmlacademy.org/img/mastercard-horizontal.v2.svg" alt="Mastercard" title="Mastercard" width="35" height="35"></div></div></footer><div class="modal"><div class="modal__inner"><div class="modal__wrapper js-login hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Log in</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aebbfc00b2e"><input type="hidden" name="csrf_value" value="7fc85cc16dea7b523346729678489909"><div class="form__group"><label class="sr-only" for="login-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="login-email"></div><div class="form__group"><label class="sr-only" for="login-password">Password</label><input class="field field--text field--full-width ym-disable-keys" type="password" name="password" placeholder="Password" id="login-password"></div><input class="button button--full-width" type="submit" data-submit-text="Logging in…" value="Log in"></form><p class="modal__forgot-password"><a href="/recover" data-modal="open" data-value="recover">Forgot your password?</a></p><a class="modal__bottom-link" href="/signup" data-modal="open" data-value="register">Sign up</a></div><div class="modal__wrapper js-register hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Sign up</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/signup?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" autocomplete="off" method="post"><input type="hidden" name="csrf_name" value="csrf69aebbfc00b2e"><input type="hidden" name="csrf_value" value="7fc85cc16dea7b523346729678489909"><div class="form__group"><label class="sr-only" for="email">
Email
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="email" name="email" value="" id="email" required placeholder="Email"></div></div><div class="form__group"><label class="sr-only" for="password">
Password
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="password" name="password" value="" id="password" required placeholder="Password"></div></div><div class="form__group"><label class="checkbox"><input class="checkbox__input" type="checkbox" name="agreement" value="1" required><span class="checkbox__text"><span>By signing up, you agree to our <a href="/docs/agreement" target="_blank">License Agreement</a> and <a href="/docs/privacy" target="_blank">Privacy Policy</a>.</span></span></label></div><input class="button button--full-width" type="submit" data-submit-text="Signing up…" value="Sign up"></form><a class="modal__bottom-link" href="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-arrays-functions%2Fsummary" data-modal="open" data-value="login">Log in</a></div><div class="modal__wrapper modal__wrapper--no-btn-bottom js-recover hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Restore access</h4><p class="modal__text-accent">Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.</p><form class="modal__form form" action="/recover" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aebbfc00b2e"><input type="hidden" name="csrf_value" value="7fc85cc16dea7b523346729678489909"><div class="form__group"><label class="sr-only" for="recovery-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="recovery-email"></div><script src='https://www.google.com/recaptcha/api.js'></script><div class="form__group"><div class="g-recaptcha" data-sitekey="6LetCTEqAAAAANROWtPzfC7Rfg9iIRiRt2k2FPn7"></div></div><input class="button button--full-width" type="submit" data-submit-text="Sending…" value="Send"></form><p class="modal__text">Forgot to connect your email to the profile? Email us and we’ll help.</p></div></div></div><script async src="https://assets.htmlacademy.org/js/general.v274.js" data-assets="https://assets.htmlacademy.org" data-require="toggle,navigation-courses,modal,form,nav"></script></body></html>