Skip to content

Instantly share code, notes, and snippets.

@ruslanashaari
Created September 8, 2017 00:27
Show Gist options
  • Select an option

  • Save ruslanashaari/515013c0afe88d900804bb69c2c9bbf6 to your computer and use it in GitHub Desktop.

Select an option

Save ruslanashaari/515013c0afe88d900804bb69c2c9bbf6 to your computer and use it in GitHub Desktop.
Given a DNA strand, return its RNA complement (per RNA transcription) #exercism
<?php
function toRna($nucleotides) {
$dnaToRna = [
"G" => "C",
"C" => "G",
"T" => "A",
"A" => "U"
];
return strtr(strtoupper($nucleotides), $dnaToRna);
//php strtr will replace the first parameter with its complement value in second parameter
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment