Created
September 8, 2017 00:27
-
-
Save ruslanashaari/515013c0afe88d900804bb69c2c9bbf6 to your computer and use it in GitHub Desktop.
Given a DNA strand, return its RNA complement (per RNA transcription) #exercism
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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