Focus mode
Verilen dizideki boş elemanları temizleyerek belirtilen adette rastgele değerlerden dizi oluşturan bir fonksiyon yazın. (array_map()
, array_filter()
ve array_rand()
fonksiyonlarını kullanarak.)
Örnek:
$planets = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "", "", NULL];
print_r(sizinFonksiyonunuz($planets, 2));
print_r(sizinFonksiyonunuz($planets, 3));
print_r(sizinFonksiyonunuz($planets, 2));
print_r(sizinFonksiyonunuz($planets, 4));
print_r(sizinFonksiyonunuz($planets, 5));
Ekran Çıktısı;
Array
(
[0] => Venus
[1] => Mars
)
Array
(
[0] => Earth
[1] => Jupiter
[2] => Uranus
)
Array
(
[0] => Mars
[1] => Uranus
)
Array
(
[0] => Venus
[1] => Earth
[2] => Jupiter
[3] => Neptune
)
Array
(
[0] => Mercury
[1] => Earth
[2] => Saturn
[3] => Uranus
[4] => Neptune
)
Training Programs to Accelerate Your Software Career Progression
Are you struggling to learn software development on your own, and find yourself needing a mentor at challenging moments? Join our intensive 4-8 month training bootcamps with Patika+ programs, gain all the necessary skills with project-based live classes and trainings tailored just for you, and start your career!
You need to enroll in the course to be able to comment!