Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
keep calm, keep learning.

Adimas Lutfi kraizt

:octocat:
keep calm, keep learning.
  • Yogyakarta
View GitHub Profile
View case_study_11.php
<?php
$users = [
[
'id' => 1,
'name' => 'Adimas Lutfi Wicaksono',
],
[
'id' => 2,
'name' => 'Salman Alfarisi',
View case_study_10.php
<?php
$names = ['Adimas Lutfi Wicaksono', 'Salman Alfarisi', 'Adimas Lutfi Wicaksono', 'Muhammad Sholeh', 'Yadi Cahyadi', 'Maya Maulani', 'Maya Maulani'];
$name = array_unique($names);
print_r($name);
View case_study_09.php
<?php
$users = [
'user1@example.com' => 'Adimas Lutfi Wicaksono',
'user2@example.com' => 'Salman Alfarisi',
'user3@example.com' => 'Muhammad Sholeh',
'user4@example.com' => 'Yadi Cahyadi',
'user5@example.com' => 'Maya Maulani',
];
View case_study_08.php
<?php
$users = [
'user1@example.com' => 'Adimas Lutfi Wicaksono',
'user2@example.com' => 'Salman Alfarisi',
'user3@example.com' => 'Muhammad Sholeh',
'user4@example.com' => 'Yadi Cahyadi',
'user5@example.com' => 'Maya Maulani',
];
View case_study_07.php
<?php
$input_one = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
$input_two = ['Ricky Andika Putra', 'Yandi Fitriyanto', 'Muhammad Sholeh', 'Yadi Cahyadi'];
$result = array_count_values(array_merge($input_one, $input_two));
foreach ($result as $key => $value)
{
if($value == 2)
View case_study_06.php
<?php
$input_one = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
$input_two = ['Ricky Andika Putra', 'Yandi Fitriyanto', 'Muhammad Sholeh', 'Yadi Cahyadi'];
array_shift($input_one);
array_pop($input_one);
$result = $input_one;
print_r($result);
View case_study_05.php
<?php
$input_one = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
$input_two = ['Ricky Andika Putra', 'Yandi Fitriyanto', 'Muhammad Sholeh', 'Yadi Cahyadi'];
array_slice($input_two, 2);
$result = array_merge($input_one, $input_two);
print_r($result);
View case_study_04.php
<?php
$users = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
array_shift($users);
$result = $users;
print_r($result);
View case_study_03.php
<?php
$users = ['Ricky Andika Putra', 'Ramadani', 'Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
array_pop($users);
print_r($users);
View case_study_02.php
<?php
$users = ['Asep Dadang Supriadi', 'Akmal Fuady', 'Yandi Fitriyanto'];
$users_new = ['Ricky Andika Putra', 'Ramadani'];
$result = array_merge($users_new, $users);
print_r($result);