<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>arrowFunctions on Alfredo Mendoza</title>
    <link>/tags/arrowfunctions/</link>
    <description>Recent content in arrowFunctions on Alfredo Mendoza</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>es-PE</language>
    <copyright>Alfredo Mendoza</copyright>
    <lastBuildDate>Wed, 08 Apr 2020 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="/tags/arrowfunctions/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Funciones flecha en PHP 7.4</title>
      <link>/posts/arrow-functions-php/</link>
      <pubDate>Wed, 08 Apr 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/arrow-functions-php/</guid>
      <description>PHP 7.4 vino con una nueva feature donde ahora nos permite hacer funciones flecha!!, pero ¿cómo se utiliza está nueva funcionalidad?.
Para empezar hay ciertas restricciones:
 Siempre deben retornar un valor. Siempre se crea está función empezando son la palabra fn.  Ahora, veamos un ejemplo:
&amp;lt;?php // Recuperaremos los números pares del array con ayuda de la función array_filter()  $array = [2, 3, 4, 6, 7, 9]; // Forma más larga $filteredArray = array_filter(function ($num) { return $num % 2 == 0; }, $array); // Con Arrow Functions $filteredArray = array_filter($array, fn ($num) =&amp;gt; $num % 2 == 0); // Imprimimos el nuevo array var_dump($filteredArray); // El array filtrado será: [2, 4, 6] Esto hace que el código sea más legible y también nos ahorramos algunas líneas de más 😃.</description>
    </item>
    
  </channel>
</rss>