Skip to content

Tag: php

Determining even/odd using a array_filter

I am digging deeper into the array_filter() of php. I’ve understand the basic idea of it but fall into new problem. $array = [‘a’ => 1, ‘b’ => 2, ‘c’ => 3, ‘d’ => 4, ‘e’ => 5]; $…

Spread amount across multiple variables

Wondering if there is an elegant way to do this using a single function instead of writing something custom. For example I want to separate 100$ into 3 parts (which do NOT have to be equal). If I …

I want to delete data in xml but it can’t

When I try to delete, I can’t delete it properly. It will stuck at number 2 if(isset($_GET[‘action’])) { $mahasiswaa = simplexml_load_file(‘input.xml’); $nim = $_GET[‘nim’]; $index = 0; …