<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Maha Bouchiba </title>
    <description>The latest articles on Forem by Maha Bouchiba  (@mahabcb).</description>
    <link>https://forem.com/mahabcb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F978960%2F17ea5acf-1836-40f6-86e8-003098bc94d8.jpeg</url>
      <title>Forem: Maha Bouchiba </title>
      <link>https://forem.com/mahabcb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mahabcb"/>
    <language>en</language>
    <item>
      <title>Migrer du code legacy &lt;&lt;&lt;&lt;&lt; build un nouveau from scratch 🌈🌈🥰</title>
      <dc:creator>Maha Bouchiba </dc:creator>
      <pubDate>Sun, 02 Apr 2023 05:04:18 +0000</pubDate>
      <link>https://forem.com/mahabcb/migrer-du-code-legacy-build-un-nouveau-from-scratch-2n2p</link>
      <guid>https://forem.com/mahabcb/migrer-du-code-legacy-build-un-nouveau-from-scratch-2n2p</guid>
      <description></description>
    </item>
    <item>
      <title>Advent Of Code 2022 in PHP</title>
      <dc:creator>Maha Bouchiba </dc:creator>
      <pubDate>Thu, 01 Dec 2022 13:14:49 +0000</pubDate>
      <link>https://forem.com/mahabcb/advent-of-code-2022-in-php-2la6</link>
      <guid>https://forem.com/mahabcb/advent-of-code-2022-in-php-2la6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hi everyone !&lt;/strong&gt;&lt;br&gt;
First post here for December 1st and not a coincidence because this year I join the annual challenge Advent Of Code 2022 and created by @ericwastl (you can find him on Twitter).&lt;/p&gt;

&lt;p&gt;I code in PHP so let me share with you my code if you want to do it with the same language let me know and let's talk about your reflexion ^^&lt;/p&gt;

&lt;p&gt;Let's go and I hope I'll find the motivation to complete this challenge until the 25th !!&lt;/p&gt;

&lt;p&gt;Get the first kata after log in : &lt;a href="https://adventofcode.com/2022/day/1"&gt;https://adventofcode.com/2022/day/1&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

$input = file_get_contents('inputs/day01');
$lines= explode("
", $input);

// Part 1 
$sum = array_reduce($lines, function($carry, $item) {
    if (empty($item)) {
        $carry[] = 0;
    } else {
        $carry[count($carry)-1] += $item;
    }
    return $carry;
}, [0]);

// Get the max : 
// var_dump(max($sum));

// Part 2

function getThreeElvesCalories($input){
    $sortSum = rsort($input);
    $array= [];
    for($i=0; $i&amp;lt;3; $i++){
        $array[] = $input[$i];
    }
    return array_sum($array);
}
print_r(getThreeElvesCalories($sum));

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>adventofcode</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
