[{"data":1,"prerenderedAt":1512},["ShallowReactive",2],{"content-all-\u002Fphp\u002Fphp-fundamental\u002Farray-map":3,"related-\u002Fphp\u002Fphp-fundamental\u002Farray-map":1240,"sidebar-content":1469},[4],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"tags":11,"date":15,"weight":16,"body":17,"_type":1234,"_id":1235,"_source":1236,"_file":1237,"_stem":1238,"_extension":1239},"\u002Fphp\u002Fphp-fundamental\u002Farray-map","php-fundamental",false,"","PHP Array and Map","Essential PHP array and map functions and their usage",[12,13,14],"php","backend","arrays","2026-05-30",9,{"type":18,"children":19,"toc":1226},"root",[20,29,52,323,329,342,458,464,476,608,614,626,858,864,877,1031,1037,1042,1220],{"type":21,"tag":22,"props":23,"children":25},"element","h2",{"id":24},"array",[26],{"type":27,"value":28},"text","Array",{"type":21,"tag":30,"props":31,"children":32},"p",{},[33,35,42,44,50],{"type":27,"value":34},"In PHP, an array is a data structure that can hold multiple values. It can be indexed (numerical keys) or associative (string keys). Arrays are created using the ",{"type":21,"tag":36,"props":37,"children":39},"code",{"className":38},[],[40],{"type":27,"value":41},"array()",{"type":27,"value":43}," function or the shorthand ",{"type":21,"tag":36,"props":45,"children":47},{"className":46},[],[48],{"type":27,"value":49},"[]",{"type":27,"value":51}," syntax.",{"type":21,"tag":53,"props":54,"children":57},"pre",{"className":55,"code":56,"language":12,"meta":8,"style":8},"language-php shiki shiki-themes github-light github-dark","\u002F\u002F Indexed array\n$fruits = array(\"Apple\", \"Banana\", \"Cherry\");\n\n\u002F\u002F Associative array\n$person = array(\n    \"name\" => \"John\",\n    \"age\" => 30,\n    \"city\" => \"New York\"\n);\n\n\u002F\u002F Shorthand syntax\n$numbers = [1, 2, 3, 4, 5];\n",[58],{"type":21,"tag":36,"props":59,"children":60},{"__ignoreMap":8},[61,73,130,140,149,171,195,217,235,242,250,259],{"type":21,"tag":62,"props":63,"children":66},"span",{"class":64,"line":65},"line",1,[67],{"type":21,"tag":62,"props":68,"children":70},{"style":69},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[71],{"type":27,"value":72},"\u002F\u002F Indexed array\n",{"type":21,"tag":62,"props":74,"children":76},{"class":64,"line":75},2,[77,83,89,95,100,106,111,116,120,125],{"type":21,"tag":62,"props":78,"children":80},{"style":79},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[81],{"type":27,"value":82},"$fruits ",{"type":21,"tag":62,"props":84,"children":86},{"style":85},"--shiki-default:#D73A49;--shiki-dark:#F97583",[87],{"type":27,"value":88},"=",{"type":21,"tag":62,"props":90,"children":92},{"style":91},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[93],{"type":27,"value":94}," array",{"type":21,"tag":62,"props":96,"children":97},{"style":79},[98],{"type":27,"value":99},"(",{"type":21,"tag":62,"props":101,"children":103},{"style":102},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[104],{"type":27,"value":105},"\"Apple\"",{"type":21,"tag":62,"props":107,"children":108},{"style":79},[109],{"type":27,"value":110},", ",{"type":21,"tag":62,"props":112,"children":113},{"style":102},[114],{"type":27,"value":115},"\"Banana\"",{"type":21,"tag":62,"props":117,"children":118},{"style":79},[119],{"type":27,"value":110},{"type":21,"tag":62,"props":121,"children":122},{"style":102},[123],{"type":27,"value":124},"\"Cherry\"",{"type":21,"tag":62,"props":126,"children":127},{"style":79},[128],{"type":27,"value":129},");\n",{"type":21,"tag":62,"props":131,"children":133},{"class":64,"line":132},3,[134],{"type":21,"tag":62,"props":135,"children":137},{"emptyLinePlaceholder":136},true,[138],{"type":27,"value":139},"\n",{"type":21,"tag":62,"props":141,"children":143},{"class":64,"line":142},4,[144],{"type":21,"tag":62,"props":145,"children":146},{"style":69},[147],{"type":27,"value":148},"\u002F\u002F Associative array\n",{"type":21,"tag":62,"props":150,"children":152},{"class":64,"line":151},5,[153,158,162,166],{"type":21,"tag":62,"props":154,"children":155},{"style":79},[156],{"type":27,"value":157},"$person ",{"type":21,"tag":62,"props":159,"children":160},{"style":85},[161],{"type":27,"value":88},{"type":21,"tag":62,"props":163,"children":164},{"style":91},[165],{"type":27,"value":94},{"type":21,"tag":62,"props":167,"children":168},{"style":79},[169],{"type":27,"value":170},"(\n",{"type":21,"tag":62,"props":172,"children":174},{"class":64,"line":173},6,[175,180,185,190],{"type":21,"tag":62,"props":176,"children":177},{"style":102},[178],{"type":27,"value":179},"    \"name\"",{"type":21,"tag":62,"props":181,"children":182},{"style":85},[183],{"type":27,"value":184}," =>",{"type":21,"tag":62,"props":186,"children":187},{"style":102},[188],{"type":27,"value":189}," \"John\"",{"type":21,"tag":62,"props":191,"children":192},{"style":79},[193],{"type":27,"value":194},",\n",{"type":21,"tag":62,"props":196,"children":198},{"class":64,"line":197},7,[199,204,208,213],{"type":21,"tag":62,"props":200,"children":201},{"style":102},[202],{"type":27,"value":203},"    \"age\"",{"type":21,"tag":62,"props":205,"children":206},{"style":85},[207],{"type":27,"value":184},{"type":21,"tag":62,"props":209,"children":210},{"style":91},[211],{"type":27,"value":212}," 30",{"type":21,"tag":62,"props":214,"children":215},{"style":79},[216],{"type":27,"value":194},{"type":21,"tag":62,"props":218,"children":220},{"class":64,"line":219},8,[221,226,230],{"type":21,"tag":62,"props":222,"children":223},{"style":102},[224],{"type":27,"value":225},"    \"city\"",{"type":21,"tag":62,"props":227,"children":228},{"style":85},[229],{"type":27,"value":184},{"type":21,"tag":62,"props":231,"children":232},{"style":102},[233],{"type":27,"value":234}," \"New York\"\n",{"type":21,"tag":62,"props":236,"children":237},{"class":64,"line":16},[238],{"type":21,"tag":62,"props":239,"children":240},{"style":79},[241],{"type":27,"value":129},{"type":21,"tag":62,"props":243,"children":245},{"class":64,"line":244},10,[246],{"type":21,"tag":62,"props":247,"children":248},{"emptyLinePlaceholder":136},[249],{"type":27,"value":139},{"type":21,"tag":62,"props":251,"children":253},{"class":64,"line":252},11,[254],{"type":21,"tag":62,"props":255,"children":256},{"style":69},[257],{"type":27,"value":258},"\u002F\u002F Shorthand syntax\n",{"type":21,"tag":62,"props":260,"children":262},{"class":64,"line":261},12,[263,268,272,277,282,286,291,295,300,304,309,313,318],{"type":21,"tag":62,"props":264,"children":265},{"style":79},[266],{"type":27,"value":267},"$numbers ",{"type":21,"tag":62,"props":269,"children":270},{"style":85},[271],{"type":27,"value":88},{"type":21,"tag":62,"props":273,"children":274},{"style":79},[275],{"type":27,"value":276}," [",{"type":21,"tag":62,"props":278,"children":279},{"style":91},[280],{"type":27,"value":281},"1",{"type":21,"tag":62,"props":283,"children":284},{"style":79},[285],{"type":27,"value":110},{"type":21,"tag":62,"props":287,"children":288},{"style":91},[289],{"type":27,"value":290},"2",{"type":21,"tag":62,"props":292,"children":293},{"style":79},[294],{"type":27,"value":110},{"type":21,"tag":62,"props":296,"children":297},{"style":91},[298],{"type":27,"value":299},"3",{"type":21,"tag":62,"props":301,"children":302},{"style":79},[303],{"type":27,"value":110},{"type":21,"tag":62,"props":305,"children":306},{"style":91},[307],{"type":27,"value":308},"4",{"type":21,"tag":62,"props":310,"children":311},{"style":79},[312],{"type":27,"value":110},{"type":21,"tag":62,"props":314,"children":315},{"style":91},[316],{"type":27,"value":317},"5",{"type":21,"tag":62,"props":319,"children":320},{"style":79},[321],{"type":27,"value":322},"];\n",{"type":21,"tag":22,"props":324,"children":326},{"id":325},"array-map",[327],{"type":27,"value":328},"Array Map",{"type":21,"tag":30,"props":330,"children":331},{},[332,334,340],{"type":27,"value":333},"The ",{"type":21,"tag":36,"props":335,"children":337},{"className":336},[],[338],{"type":27,"value":339},"array_map()",{"type":27,"value":341}," function applies a callback function to each element of an array and returns a new array with the modified values.",{"type":21,"tag":53,"props":343,"children":345},{"className":55,"code":344,"language":12,"meta":8,"style":8},"$numbers = [1, 2, 3, 4, 5];\n$squared = array_map(fn($n) => $n ** 2, $numbers);\n\u002F\u002F $squared is now [1, 4, 9, 16, 25]\n",[346],{"type":21,"tag":36,"props":347,"children":348},{"__ignoreMap":8},[349,404,450],{"type":21,"tag":62,"props":350,"children":351},{"class":64,"line":65},[352,356,360,364,368,372,376,380,384,388,392,396,400],{"type":21,"tag":62,"props":353,"children":354},{"style":79},[355],{"type":27,"value":267},{"type":21,"tag":62,"props":357,"children":358},{"style":85},[359],{"type":27,"value":88},{"type":21,"tag":62,"props":361,"children":362},{"style":79},[363],{"type":27,"value":276},{"type":21,"tag":62,"props":365,"children":366},{"style":91},[367],{"type":27,"value":281},{"type":21,"tag":62,"props":369,"children":370},{"style":79},[371],{"type":27,"value":110},{"type":21,"tag":62,"props":373,"children":374},{"style":91},[375],{"type":27,"value":290},{"type":21,"tag":62,"props":377,"children":378},{"style":79},[379],{"type":27,"value":110},{"type":21,"tag":62,"props":381,"children":382},{"style":91},[383],{"type":27,"value":299},{"type":21,"tag":62,"props":385,"children":386},{"style":79},[387],{"type":27,"value":110},{"type":21,"tag":62,"props":389,"children":390},{"style":91},[391],{"type":27,"value":308},{"type":21,"tag":62,"props":393,"children":394},{"style":79},[395],{"type":27,"value":110},{"type":21,"tag":62,"props":397,"children":398},{"style":91},[399],{"type":27,"value":317},{"type":21,"tag":62,"props":401,"children":402},{"style":79},[403],{"type":27,"value":322},{"type":21,"tag":62,"props":405,"children":406},{"class":64,"line":75},[407,412,416,421,425,430,435,440,445],{"type":21,"tag":62,"props":408,"children":409},{"style":79},[410],{"type":27,"value":411},"$squared ",{"type":21,"tag":62,"props":413,"children":414},{"style":85},[415],{"type":27,"value":88},{"type":21,"tag":62,"props":417,"children":418},{"style":91},[419],{"type":27,"value":420}," array_map",{"type":21,"tag":62,"props":422,"children":423},{"style":79},[424],{"type":27,"value":99},{"type":21,"tag":62,"props":426,"children":427},{"style":85},[428],{"type":27,"value":429},"fn",{"type":21,"tag":62,"props":431,"children":432},{"style":79},[433],{"type":27,"value":434},"($n) => $n ",{"type":21,"tag":62,"props":436,"children":437},{"style":85},[438],{"type":27,"value":439},"**",{"type":21,"tag":62,"props":441,"children":442},{"style":91},[443],{"type":27,"value":444}," 2",{"type":21,"tag":62,"props":446,"children":447},{"style":79},[448],{"type":27,"value":449},", $numbers);\n",{"type":21,"tag":62,"props":451,"children":452},{"class":64,"line":132},[453],{"type":21,"tag":62,"props":454,"children":455},{"style":69},[456],{"type":27,"value":457},"\u002F\u002F $squared is now [1, 4, 9, 16, 25]\n",{"type":21,"tag":22,"props":459,"children":461},{"id":460},"array-filter",[462],{"type":27,"value":463},"Array Filter",{"type":21,"tag":30,"props":465,"children":466},{},[467,468,474],{"type":27,"value":333},{"type":21,"tag":36,"props":469,"children":471},{"className":470},[],[472],{"type":27,"value":473},"array_filter()",{"type":27,"value":475}," function filters elements of an array using a callback function and returns a new array with the elements that pass the test.",{"type":21,"tag":53,"props":477,"children":479},{"className":55,"code":478,"language":12,"meta":8,"style":8},"$numbers = [1, 2, 3, 4, 5, 6];\n$even = array_filter($numbers, fn($n) => $n % 2 === 0);\n\u002F\u002F $even is now [2, 4, 6]\n",[480],{"type":21,"tag":36,"props":481,"children":482},{"__ignoreMap":8},[483,547,600],{"type":21,"tag":62,"props":484,"children":485},{"class":64,"line":65},[486,490,494,498,502,506,510,514,518,522,526,530,534,538,543],{"type":21,"tag":62,"props":487,"children":488},{"style":79},[489],{"type":27,"value":267},{"type":21,"tag":62,"props":491,"children":492},{"style":85},[493],{"type":27,"value":88},{"type":21,"tag":62,"props":495,"children":496},{"style":79},[497],{"type":27,"value":276},{"type":21,"tag":62,"props":499,"children":500},{"style":91},[501],{"type":27,"value":281},{"type":21,"tag":62,"props":503,"children":504},{"style":79},[505],{"type":27,"value":110},{"type":21,"tag":62,"props":507,"children":508},{"style":91},[509],{"type":27,"value":290},{"type":21,"tag":62,"props":511,"children":512},{"style":79},[513],{"type":27,"value":110},{"type":21,"tag":62,"props":515,"children":516},{"style":91},[517],{"type":27,"value":299},{"type":21,"tag":62,"props":519,"children":520},{"style":79},[521],{"type":27,"value":110},{"type":21,"tag":62,"props":523,"children":524},{"style":91},[525],{"type":27,"value":308},{"type":21,"tag":62,"props":527,"children":528},{"style":79},[529],{"type":27,"value":110},{"type":21,"tag":62,"props":531,"children":532},{"style":91},[533],{"type":27,"value":317},{"type":21,"tag":62,"props":535,"children":536},{"style":79},[537],{"type":27,"value":110},{"type":21,"tag":62,"props":539,"children":540},{"style":91},[541],{"type":27,"value":542},"6",{"type":21,"tag":62,"props":544,"children":545},{"style":79},[546],{"type":27,"value":322},{"type":21,"tag":62,"props":548,"children":549},{"class":64,"line":75},[550,555,559,564,569,573,577,582,586,591,596],{"type":21,"tag":62,"props":551,"children":552},{"style":79},[553],{"type":27,"value":554},"$even ",{"type":21,"tag":62,"props":556,"children":557},{"style":85},[558],{"type":27,"value":88},{"type":21,"tag":62,"props":560,"children":561},{"style":91},[562],{"type":27,"value":563}," array_filter",{"type":21,"tag":62,"props":565,"children":566},{"style":79},[567],{"type":27,"value":568},"($numbers, ",{"type":21,"tag":62,"props":570,"children":571},{"style":85},[572],{"type":27,"value":429},{"type":21,"tag":62,"props":574,"children":575},{"style":79},[576],{"type":27,"value":434},{"type":21,"tag":62,"props":578,"children":579},{"style":85},[580],{"type":27,"value":581},"%",{"type":21,"tag":62,"props":583,"children":584},{"style":91},[585],{"type":27,"value":444},{"type":21,"tag":62,"props":587,"children":588},{"style":85},[589],{"type":27,"value":590}," ===",{"type":21,"tag":62,"props":592,"children":593},{"style":91},[594],{"type":27,"value":595}," 0",{"type":21,"tag":62,"props":597,"children":598},{"style":79},[599],{"type":27,"value":129},{"type":21,"tag":62,"props":601,"children":602},{"class":64,"line":132},[603],{"type":21,"tag":62,"props":604,"children":605},{"style":69},[606],{"type":27,"value":607},"\u002F\u002F $even is now [2, 4, 6]\n",{"type":21,"tag":22,"props":609,"children":611},{"id":610},"array-reduce",[612],{"type":27,"value":613},"Array Reduce",{"type":21,"tag":30,"props":615,"children":616},{},[617,618,624],{"type":27,"value":333},{"type":21,"tag":36,"props":619,"children":621},{"className":620},[],[622],{"type":27,"value":623},"array_reduce()",{"type":27,"value":625}," function reduces an array to a single value using a callback function.",{"type":21,"tag":53,"props":627,"children":629},{"className":55,"code":628,"language":12,"meta":8,"style":8},"$items = [\n    ['name' => 'Apple', 'price' => 1.50],\n    ['name' => 'Banana', 'price' => 0.75],\n    ['name' => 'Cherry', 'price' => 2.00],\n];\n\n$total = array_reduce($items, fn($carry, $item) => $carry + $item['price'], 0);\n\u002F\u002F $total is now 4.25\n",[630],{"type":21,"tag":36,"props":631,"children":632},{"__ignoreMap":8},[633,650,695,736,777,784,791,850],{"type":21,"tag":62,"props":634,"children":635},{"class":64,"line":65},[636,641,645],{"type":21,"tag":62,"props":637,"children":638},{"style":79},[639],{"type":27,"value":640},"$items ",{"type":21,"tag":62,"props":642,"children":643},{"style":85},[644],{"type":27,"value":88},{"type":21,"tag":62,"props":646,"children":647},{"style":79},[648],{"type":27,"value":649}," [\n",{"type":21,"tag":62,"props":651,"children":652},{"class":64,"line":75},[653,658,663,667,672,676,681,685,690],{"type":21,"tag":62,"props":654,"children":655},{"style":79},[656],{"type":27,"value":657},"    [",{"type":21,"tag":62,"props":659,"children":660},{"style":102},[661],{"type":27,"value":662},"'name'",{"type":21,"tag":62,"props":664,"children":665},{"style":85},[666],{"type":27,"value":184},{"type":21,"tag":62,"props":668,"children":669},{"style":102},[670],{"type":27,"value":671}," 'Apple'",{"type":21,"tag":62,"props":673,"children":674},{"style":79},[675],{"type":27,"value":110},{"type":21,"tag":62,"props":677,"children":678},{"style":102},[679],{"type":27,"value":680},"'price'",{"type":21,"tag":62,"props":682,"children":683},{"style":85},[684],{"type":27,"value":184},{"type":21,"tag":62,"props":686,"children":687},{"style":91},[688],{"type":27,"value":689}," 1.50",{"type":21,"tag":62,"props":691,"children":692},{"style":79},[693],{"type":27,"value":694},"],\n",{"type":21,"tag":62,"props":696,"children":697},{"class":64,"line":132},[698,702,706,710,715,719,723,727,732],{"type":21,"tag":62,"props":699,"children":700},{"style":79},[701],{"type":27,"value":657},{"type":21,"tag":62,"props":703,"children":704},{"style":102},[705],{"type":27,"value":662},{"type":21,"tag":62,"props":707,"children":708},{"style":85},[709],{"type":27,"value":184},{"type":21,"tag":62,"props":711,"children":712},{"style":102},[713],{"type":27,"value":714}," 'Banana'",{"type":21,"tag":62,"props":716,"children":717},{"style":79},[718],{"type":27,"value":110},{"type":21,"tag":62,"props":720,"children":721},{"style":102},[722],{"type":27,"value":680},{"type":21,"tag":62,"props":724,"children":725},{"style":85},[726],{"type":27,"value":184},{"type":21,"tag":62,"props":728,"children":729},{"style":91},[730],{"type":27,"value":731}," 0.75",{"type":21,"tag":62,"props":733,"children":734},{"style":79},[735],{"type":27,"value":694},{"type":21,"tag":62,"props":737,"children":738},{"class":64,"line":142},[739,743,747,751,756,760,764,768,773],{"type":21,"tag":62,"props":740,"children":741},{"style":79},[742],{"type":27,"value":657},{"type":21,"tag":62,"props":744,"children":745},{"style":102},[746],{"type":27,"value":662},{"type":21,"tag":62,"props":748,"children":749},{"style":85},[750],{"type":27,"value":184},{"type":21,"tag":62,"props":752,"children":753},{"style":102},[754],{"type":27,"value":755}," 'Cherry'",{"type":21,"tag":62,"props":757,"children":758},{"style":79},[759],{"type":27,"value":110},{"type":21,"tag":62,"props":761,"children":762},{"style":102},[763],{"type":27,"value":680},{"type":21,"tag":62,"props":765,"children":766},{"style":85},[767],{"type":27,"value":184},{"type":21,"tag":62,"props":769,"children":770},{"style":91},[771],{"type":27,"value":772}," 2.00",{"type":21,"tag":62,"props":774,"children":775},{"style":79},[776],{"type":27,"value":694},{"type":21,"tag":62,"props":778,"children":779},{"class":64,"line":151},[780],{"type":21,"tag":62,"props":781,"children":782},{"style":79},[783],{"type":27,"value":322},{"type":21,"tag":62,"props":785,"children":786},{"class":64,"line":173},[787],{"type":21,"tag":62,"props":788,"children":789},{"emptyLinePlaceholder":136},[790],{"type":27,"value":139},{"type":21,"tag":62,"props":792,"children":793},{"class":64,"line":197},[794,799,803,808,813,817,822,827,832,836,841,846],{"type":21,"tag":62,"props":795,"children":796},{"style":79},[797],{"type":27,"value":798},"$total ",{"type":21,"tag":62,"props":800,"children":801},{"style":85},[802],{"type":27,"value":88},{"type":21,"tag":62,"props":804,"children":805},{"style":91},[806],{"type":27,"value":807}," array_reduce",{"type":21,"tag":62,"props":809,"children":810},{"style":79},[811],{"type":27,"value":812},"($items, ",{"type":21,"tag":62,"props":814,"children":815},{"style":85},[816],{"type":27,"value":429},{"type":21,"tag":62,"props":818,"children":819},{"style":79},[820],{"type":27,"value":821},"($carry, $item) => $carry ",{"type":21,"tag":62,"props":823,"children":824},{"style":85},[825],{"type":27,"value":826},"+",{"type":21,"tag":62,"props":828,"children":829},{"style":79},[830],{"type":27,"value":831}," $item[",{"type":21,"tag":62,"props":833,"children":834},{"style":102},[835],{"type":27,"value":680},{"type":21,"tag":62,"props":837,"children":838},{"style":79},[839],{"type":27,"value":840},"], ",{"type":21,"tag":62,"props":842,"children":843},{"style":91},[844],{"type":27,"value":845},"0",{"type":21,"tag":62,"props":847,"children":848},{"style":79},[849],{"type":27,"value":129},{"type":21,"tag":62,"props":851,"children":852},{"class":64,"line":219},[853],{"type":21,"tag":62,"props":854,"children":855},{"style":69},[856],{"type":27,"value":857},"\u002F\u002F $total is now 4.25\n",{"type":21,"tag":22,"props":859,"children":861},{"id":860},"spread-operator",[862],{"type":27,"value":863},"Spread Operator",{"type":21,"tag":30,"props":865,"children":866},{},[867,869,875],{"type":27,"value":868},"The spread operator (",{"type":21,"tag":36,"props":870,"children":872},{"className":871},[],[873],{"type":27,"value":874},"...",{"type":27,"value":876},") allows you to unpack arrays into function arguments.",{"type":21,"tag":53,"props":878,"children":880},{"className":55,"code":879,"language":12,"meta":8,"style":8},"function sum(int ...$numbers): int\n{\n    return array_sum($numbers);\n}\n$nums = [1, 2, 3];\necho sum(...$nums);  \u002F\u002F Outputs: 6\n",[881],{"type":21,"tag":36,"props":882,"children":883},{"__ignoreMap":8},[884,927,935,953,961,1001],{"type":21,"tag":62,"props":885,"children":886},{"class":64,"line":65},[887,892,898,902,907,912,917,922],{"type":21,"tag":62,"props":888,"children":889},{"style":85},[890],{"type":27,"value":891},"function",{"type":21,"tag":62,"props":893,"children":895},{"style":894},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[896],{"type":27,"value":897}," sum",{"type":21,"tag":62,"props":899,"children":900},{"style":79},[901],{"type":27,"value":99},{"type":21,"tag":62,"props":903,"children":904},{"style":85},[905],{"type":27,"value":906},"int",{"type":21,"tag":62,"props":908,"children":909},{"style":85},[910],{"type":27,"value":911}," ...",{"type":21,"tag":62,"props":913,"children":914},{"style":79},[915],{"type":27,"value":916},"$numbers)",{"type":21,"tag":62,"props":918,"children":919},{"style":85},[920],{"type":27,"value":921},":",{"type":21,"tag":62,"props":923,"children":924},{"style":85},[925],{"type":27,"value":926}," int\n",{"type":21,"tag":62,"props":928,"children":929},{"class":64,"line":75},[930],{"type":21,"tag":62,"props":931,"children":932},{"style":79},[933],{"type":27,"value":934},"{\n",{"type":21,"tag":62,"props":936,"children":937},{"class":64,"line":132},[938,943,948],{"type":21,"tag":62,"props":939,"children":940},{"style":85},[941],{"type":27,"value":942},"    return",{"type":21,"tag":62,"props":944,"children":945},{"style":91},[946],{"type":27,"value":947}," array_sum",{"type":21,"tag":62,"props":949,"children":950},{"style":79},[951],{"type":27,"value":952},"($numbers);\n",{"type":21,"tag":62,"props":954,"children":955},{"class":64,"line":142},[956],{"type":21,"tag":62,"props":957,"children":958},{"style":79},[959],{"type":27,"value":960},"}\n",{"type":21,"tag":62,"props":962,"children":963},{"class":64,"line":151},[964,969,973,977,981,985,989,993,997],{"type":21,"tag":62,"props":965,"children":966},{"style":79},[967],{"type":27,"value":968},"$nums ",{"type":21,"tag":62,"props":970,"children":971},{"style":85},[972],{"type":27,"value":88},{"type":21,"tag":62,"props":974,"children":975},{"style":79},[976],{"type":27,"value":276},{"type":21,"tag":62,"props":978,"children":979},{"style":91},[980],{"type":27,"value":281},{"type":21,"tag":62,"props":982,"children":983},{"style":79},[984],{"type":27,"value":110},{"type":21,"tag":62,"props":986,"children":987},{"style":91},[988],{"type":27,"value":290},{"type":21,"tag":62,"props":990,"children":991},{"style":79},[992],{"type":27,"value":110},{"type":21,"tag":62,"props":994,"children":995},{"style":91},[996],{"type":27,"value":299},{"type":21,"tag":62,"props":998,"children":999},{"style":79},[1000],{"type":27,"value":322},{"type":21,"tag":62,"props":1002,"children":1003},{"class":64,"line":173},[1004,1009,1013,1017,1021,1026],{"type":21,"tag":62,"props":1005,"children":1006},{"style":91},[1007],{"type":27,"value":1008},"echo",{"type":21,"tag":62,"props":1010,"children":1011},{"style":894},[1012],{"type":27,"value":897},{"type":21,"tag":62,"props":1014,"children":1015},{"style":79},[1016],{"type":27,"value":99},{"type":21,"tag":62,"props":1018,"children":1019},{"style":85},[1020],{"type":27,"value":874},{"type":21,"tag":62,"props":1022,"children":1023},{"style":79},[1024],{"type":27,"value":1025},"$nums);  ",{"type":21,"tag":62,"props":1027,"children":1028},{"style":69},[1029],{"type":27,"value":1030},"\u002F\u002F Outputs: 6\n",{"type":21,"tag":22,"props":1032,"children":1034},{"id":1033},"array-destructuring",[1035],{"type":27,"value":1036},"Array Destructuring",{"type":21,"tag":30,"props":1038,"children":1039},{},[1040],{"type":27,"value":1041},"Array destructuring allows you to assign array values to variables in a single statement.",{"type":21,"tag":53,"props":1043,"children":1045},{"className":55,"code":1044,"language":12,"meta":8,"style":8},"\u002F\u002F Indexed array destructuring\n$coordinates = [40.7128, -74.0060];\n[$lat, $lng] = $coordinates;\n\n\u002F\u002F Named keys\n$person = ['name' => 'John', 'age' => 30];\n['name' => $name, 'age' => $age] = $person;\n",[1046],{"type":21,"tag":36,"props":1047,"children":1048},{"__ignoreMap":8},[1049,1057,1096,1113,1120,1128,1177],{"type":21,"tag":62,"props":1050,"children":1051},{"class":64,"line":65},[1052],{"type":21,"tag":62,"props":1053,"children":1054},{"style":69},[1055],{"type":27,"value":1056},"\u002F\u002F Indexed array destructuring\n",{"type":21,"tag":62,"props":1058,"children":1059},{"class":64,"line":75},[1060,1065,1069,1073,1078,1082,1087,1092],{"type":21,"tag":62,"props":1061,"children":1062},{"style":79},[1063],{"type":27,"value":1064},"$coordinates ",{"type":21,"tag":62,"props":1066,"children":1067},{"style":85},[1068],{"type":27,"value":88},{"type":21,"tag":62,"props":1070,"children":1071},{"style":79},[1072],{"type":27,"value":276},{"type":21,"tag":62,"props":1074,"children":1075},{"style":91},[1076],{"type":27,"value":1077},"40.7128",{"type":21,"tag":62,"props":1079,"children":1080},{"style":79},[1081],{"type":27,"value":110},{"type":21,"tag":62,"props":1083,"children":1084},{"style":85},[1085],{"type":27,"value":1086},"-",{"type":21,"tag":62,"props":1088,"children":1089},{"style":91},[1090],{"type":27,"value":1091},"74.0060",{"type":21,"tag":62,"props":1093,"children":1094},{"style":79},[1095],{"type":27,"value":322},{"type":21,"tag":62,"props":1097,"children":1098},{"class":64,"line":132},[1099,1104,1108],{"type":21,"tag":62,"props":1100,"children":1101},{"style":79},[1102],{"type":27,"value":1103},"[$lat, $lng] ",{"type":21,"tag":62,"props":1105,"children":1106},{"style":85},[1107],{"type":27,"value":88},{"type":21,"tag":62,"props":1109,"children":1110},{"style":79},[1111],{"type":27,"value":1112}," $coordinates;\n",{"type":21,"tag":62,"props":1114,"children":1115},{"class":64,"line":142},[1116],{"type":21,"tag":62,"props":1117,"children":1118},{"emptyLinePlaceholder":136},[1119],{"type":27,"value":139},{"type":21,"tag":62,"props":1121,"children":1122},{"class":64,"line":151},[1123],{"type":21,"tag":62,"props":1124,"children":1125},{"style":69},[1126],{"type":27,"value":1127},"\u002F\u002F Named keys\n",{"type":21,"tag":62,"props":1129,"children":1130},{"class":64,"line":173},[1131,1135,1139,1143,1147,1151,1156,1160,1165,1169,1173],{"type":21,"tag":62,"props":1132,"children":1133},{"style":79},[1134],{"type":27,"value":157},{"type":21,"tag":62,"props":1136,"children":1137},{"style":85},[1138],{"type":27,"value":88},{"type":21,"tag":62,"props":1140,"children":1141},{"style":79},[1142],{"type":27,"value":276},{"type":21,"tag":62,"props":1144,"children":1145},{"style":102},[1146],{"type":27,"value":662},{"type":21,"tag":62,"props":1148,"children":1149},{"style":85},[1150],{"type":27,"value":184},{"type":21,"tag":62,"props":1152,"children":1153},{"style":102},[1154],{"type":27,"value":1155}," 'John'",{"type":21,"tag":62,"props":1157,"children":1158},{"style":79},[1159],{"type":27,"value":110},{"type":21,"tag":62,"props":1161,"children":1162},{"style":102},[1163],{"type":27,"value":1164},"'age'",{"type":21,"tag":62,"props":1166,"children":1167},{"style":85},[1168],{"type":27,"value":184},{"type":21,"tag":62,"props":1170,"children":1171},{"style":91},[1172],{"type":27,"value":212},{"type":21,"tag":62,"props":1174,"children":1175},{"style":79},[1176],{"type":27,"value":322},{"type":21,"tag":62,"props":1178,"children":1179},{"class":64,"line":197},[1180,1185,1189,1193,1198,1202,1206,1211,1215],{"type":21,"tag":62,"props":1181,"children":1182},{"style":79},[1183],{"type":27,"value":1184},"[",{"type":21,"tag":62,"props":1186,"children":1187},{"style":102},[1188],{"type":27,"value":662},{"type":21,"tag":62,"props":1190,"children":1191},{"style":85},[1192],{"type":27,"value":184},{"type":21,"tag":62,"props":1194,"children":1195},{"style":79},[1196],{"type":27,"value":1197}," $name, ",{"type":21,"tag":62,"props":1199,"children":1200},{"style":102},[1201],{"type":27,"value":1164},{"type":21,"tag":62,"props":1203,"children":1204},{"style":85},[1205],{"type":27,"value":184},{"type":21,"tag":62,"props":1207,"children":1208},{"style":79},[1209],{"type":27,"value":1210}," $age] ",{"type":21,"tag":62,"props":1212,"children":1213},{"style":85},[1214],{"type":27,"value":88},{"type":21,"tag":62,"props":1216,"children":1217},{"style":79},[1218],{"type":27,"value":1219}," $person;\n",{"type":21,"tag":1221,"props":1222,"children":1223},"style",{},[1224],{"type":27,"value":1225},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":8,"searchDepth":132,"depth":132,"links":1227},[1228,1229,1230,1231,1232,1233],{"id":24,"depth":75,"text":28},{"id":325,"depth":75,"text":328},{"id":460,"depth":75,"text":463},{"id":610,"depth":75,"text":613},{"id":860,"depth":75,"text":863},{"id":1033,"depth":75,"text":1036},"markdown","content:php:php-fundamental:array-map.md","content","php\u002Fphp-fundamental\u002Farray-map.md","php\u002Fphp-fundamental\u002Farray-map","md",[1241,1249,1256,1261,1267,1276,1281,1286,1291,1296,1301,1310,1316,1321,1326,1331,1336,1341,1347,1355,1363,1368,1375,1382,1388,1394,1402,1408,1414,1421,1427,1433,1440,1452,1458,1463],{"_path":1242,"title":1243,"description":1244,"tags":1245,"date":1248},"\u002Fcpp","C++ \u002F CPP","C++ notes, snippets, and references",[1246,1247],"cpp","c++","2026-05-05",{"_path":1250,"title":1251,"description":1252,"tags":1253,"date":1255},"\u002Fdata-structure-algorithm\u002Farray-manipulation\u002Ffor-looping","For Looping in Python","Using for loops to manipulate arrays in Python.",[1254,13,14],"python","2026-03-18",{"_path":1257,"title":1258,"description":1259,"tags":1260,"date":1255},"\u002Fdata-structure-algorithm\u002Farray-manipulation\u002Fwhile-looping","While Looping in Python","Using while loops to manipulate arrays in Python.",[1254,13,14],{"_path":1262,"title":1263,"description":1264,"tags":1265,"date":1266},"\u002Fdata-structure-algorithm\u002Fassignments","Assignments","Assignments in Python for competitive programming.",[1254,13],"2026-04-10",{"_path":1268,"title":1269,"description":1270,"tags":1271,"date":1275},"\u002Fdata-structure-algorithm\u002Fbuzzword","Buzzword List DSA","Common terms and concepts in data structures and algorithms.",[1272,1273,1274],"dsa","algorithms","data-structures","2026-04-03",{"_path":1277,"title":1278,"description":1279,"tags":1280,"date":1266},"\u002Fdata-structure-algorithm\u002Fdata-type","Data Types","Data types in Python for competitive programming.",[1254,13],{"_path":1282,"title":1283,"description":1284,"tags":1285,"date":1266},"\u002Fdata-structure-algorithm\u002Fhash-map","Hash Map","Hash map implementation in Python for competitive programming.",[1254,13],{"_path":1287,"title":1288,"description":1289,"tags":1290,"date":1266},"\u002Fdata-structure-algorithm\u002Finput-output","Input and Output","Handling input and output in Python for competitive programming.",[1254,13],{"_path":1292,"title":1293,"description":1294,"tags":1295,"date":1255},"\u002Fdata-structure-algorithm\u002Fmath-library\u002Fsum","Sum Elements","Using for loops to sum elements in Python.",[1254,13,14],{"_path":1297,"title":1298,"description":1299,"tags":1300,"date":1255},"\u002Fdata-structure-algorithm\u002Fmath-library\u002Fsummary","Summary","Summary of the math library in Python.",[1254,13,14],{"_path":1302,"title":1303,"description":1304,"tags":1305,"date":1309},"\u002Fdocker\u002Fcheat-sheets","Docker Cheat Sheets","Cheat sheets for frequently used Docker commands and concepts",[1306,1307,1308],"docker","devops","infrastructure","2026-05-01",{"_path":1311,"title":1312,"description":1313,"tags":1314,"date":1315},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-container","Docker Container","Introduction to Docker containers and their usage",[1306,1307,1308],"2026-03-12",{"_path":1317,"title":1318,"description":1319,"tags":1320,"date":1315},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-execution","Docker Execution","Introduction to Docker execution and their usage",[1306,1307,1308],{"_path":1322,"title":1323,"description":1324,"tags":1325,"date":1315},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-image","Docker Image","Introduction to Docker images and their usage",[1306,1307,1308],{"_path":1327,"title":1328,"description":1329,"tags":1330,"date":1315},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-logging","Docker Logging","Introduction to Docker logging and their usage",[1306,1307,1308],{"_path":1332,"title":1333,"description":1334,"tags":1335,"date":1315},"\u002Fdocker\u002Fdocker-prerequisites\u002Fdocker-installation","Docker Installation","Introduction to Docker installation and their usage",[1306,1307,1308],{"_path":1337,"title":1338,"description":1339,"tags":1340,"date":1315},"\u002Fdocker\u002Fresources","Docker Resources","Collection of Docker resources for learning and reference",[1306,1307,1308],{"_path":1342,"title":1343,"description":1344,"tags":1345,"date":1248},"\u002Fjava","Java","Java notes, snippets, and references",[1346],"java",{"_path":1348,"title":1349,"description":1350,"tags":1351,"date":1315},"\u002Fjavascript\u002Fpromises","Promise Patterns","Common JavaScript promise patterns and async\u002Fawait usage",[1352,1353,1354],"javascript","frontend","async",{"_path":1356,"title":1357,"description":1358,"tags":1359,"date":1248},"\u002Fjenkins","Jenkins","Jenkins notes, snippets, and references",[1360,1361,1362],"jenkins","ci","cd",{"_path":1364,"title":1365,"description":1366,"tags":1367,"date":1255},"\u002Fphp\u002Farrays","PHP Array Functions","Essential PHP array functions and patterns",[12,13,14],{"_path":1369,"title":1370,"description":1371,"tags":1372,"date":1374},"\u002Fphp\u002Fpatterns\u002Fsingleton","Singleton Pattern","Implementing the singleton pattern in PHP",[12,1373,13],"patterns","2026-03-13",{"_path":1376,"title":1377,"description":1378,"tags":1379,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fcasting-convertions","PHP Casting and Conversions","Learning about PHP casting and conversions",[12,13,1380,1381],"casting","conversions",{"_path":1383,"title":1384,"description":1385,"tags":1386,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fcomments","PHP Comments","Essential PHP comment operations",[12,13,1387],"comments",{"_path":1389,"title":1390,"description":1391,"tags":1392,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fdatatypes","PHP Data Types","Essential PHP data types and their usage",[12,13,1393],"data types",{"_path":1395,"title":1396,"description":1397,"tags":1398,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fexpression-statement-block","PHP Expressions, Statements, and Blocks","Essential PHP expressions, statements, and blocks",[12,13,1399,1400,1401],"expressions","statements","blocks",{"_path":1403,"title":1404,"description":1405,"tags":1406,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fflow-control","PHP Flow Control","Essential PHP flow control structures and patterns",[12,13,1407],"flow control",{"_path":1409,"title":1410,"description":1411,"tags":1412,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Ffunctions","PHP Functions","Essential PHP functions and their usage",[12,13,1413],"functions",{"_path":1415,"title":1416,"description":1417,"tags":1418,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Finclude-require","PHP Include and Require","Understanding PHP include and require statements",[12,13,1419,1420],"include","require",{"_path":1422,"title":1423,"description":1424,"tags":1425,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fintroduction","PHP Introduction","An introduction to PHP programming language and its fundamentals",[12,13,1426],"introduction",{"_path":1428,"title":1429,"description":1430,"tags":1431,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Foperator","PHP Operators","Essential PHP operators and their usage",[12,13,1432],"operators",{"_path":1434,"title":1435,"description":1436,"tags":1437,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Foutput-input","PHP Output & Input","Learning about PHP output and input methods",[12,13,1438,1439],"output","input",{"_path":1441,"title":1442,"description":1443,"tags":1444,"date":15},"\u002Fphp\u002Fphp-fundamental\u002Fvariables","PHP Variables","Essential PHP variables, constants, magic constants, and variable scope",[12,13,1445,1446,1447,1448,1449,1450,1451],"variables","constants","magic constants","scope","global","local","static",{"_path":1453,"title":1454,"description":1455,"tags":1456,"date":1457},"\u002Fphp\u002Freferences","PHP References (&)","Useful PHP reference snippets and patterns",[12,13],"2026-03-19",{"_path":1459,"title":1460,"description":1461,"tags":1462,"date":1248},"\u002Fpython","Python","Python notes, snippets, and references",[1254],{"_path":1464,"title":1465,"description":1466,"tags":1467,"date":1248},"\u002Frust","Rust","Rust notes, snippets, and references",[1468],"rust",[1470,1471,1472,1473,1474,1475,1476,1477,1478,1480,1481,1483,1484,1486,1488,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511],{"_path":1242,"title":1243,"weight":65},{"_path":1250,"title":1251,"weight":244},{"_path":1257,"title":1258,"weight":244},{"_path":1262,"title":1263,"weight":132},{"_path":1268,"title":1269,"weight":65},{"_path":1277,"title":1278,"weight":75},{"_path":1282,"title":1283,"weight":244},{"_path":1287,"title":1288,"weight":65},{"_path":1292,"title":1293,"weight":1479},20,{"_path":1297,"title":1298,"weight":244},{"_path":1302,"title":1303,"weight":1482},100,{"_path":1311,"title":1312,"weight":1479},{"_path":1317,"title":1318,"weight":1485},22,{"_path":1322,"title":1323,"weight":1487},21,{"_path":1327,"title":1328,"weight":1489},23,{"_path":1332,"title":1333,"weight":244},{"_path":1337,"title":1338,"weight":65},{"_path":1342,"title":1343,"weight":65},{"_path":1348,"title":1349},{"_path":1356,"title":1357,"weight":65},{"_path":1364,"title":1365,"weight":65},{"_path":1369,"title":1370},{"_path":5,"title":9,"weight":16},{"_path":1376,"title":1377,"weight":173},{"_path":1383,"title":1384,"weight":132},{"_path":1389,"title":1390,"weight":151},{"_path":1395,"title":1396,"weight":219},{"_path":1403,"title":1404,"weight":244},{"_path":1409,"title":1410,"weight":252},{"_path":1415,"title":1416,"weight":261},{"_path":1422,"title":1423,"weight":65},{"_path":1428,"title":1429,"weight":197},{"_path":1434,"title":1435,"weight":75},{"_path":1441,"title":1442,"weight":142},{"_path":1453,"title":1454,"weight":75},{"_path":1459,"title":1460,"weight":65},{"_path":1464,"title":1465,"weight":65},1780160024390]