Generation

generate functionTue, 02 May 2023

order an array of animal names by animal size

function orderBySize($animals) { $sizes = [ 'elephant' => 'large', 'mouse' => 'small', 'rabbit' => 'small', 'dog' => 'medium', 'leopard' => 'medium', 'cheetah' => 'medium', 'lion' => 'large', 'tiger' => 'large', 'giraffe' => 'large', 'rhino' => 'large', 'hippo' => 'large', 'zebra' => 'large', 'wolverine' => 'medium', 'baboon' => 'medium', 'cow' => 'large', 'pig' => 'large', 'sheep' => 'medium', 'goat' => 'medium', 'horse' => 'large', 'donkey' => 'large', 'ostrich' => 'large', 'kangaroo' => 'medium', 'crocodile' =>

Questions about programming?Chat with your personal AI assistant