Created
May 19, 2015 00:53
-
-
Save hellofromtonya/45bf9c99e87fb51d7af1 to your computer and use it in GitHub Desktop.
WordPress Challenge for May 18, 2015
This file contains 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 | |
/** | |
* As part of our weekly challenges, take a crack at this one. | |
* To play along, | |
* 1. Copy the code into a Gist, | |
* 2. Answer each of the questions by supplying the code; | |
* 3. Provide some notes as to your train of thought; | |
* 4. Then submit the gist's URL for us to review. | |
* | |
* We'll respond back and make comments in your gist. | |
* Happy Coding </> | |
* Tonya @hellofromtonya | |
*/ | |
function foo( $user_id ) { | |
// Q1 How can I get the arguments pass when foo is called? | |
// Q2 How can I get a count of the number arguments passed into foo? | |
// Q3 How would you sanitize the meta value, if it is present? | |
if ( $meta_value && $meta_key ) { | |
update_user_meta( $user_id, $meta_key, $meta_value ); | |
} | |
} | |
$user_id = 1; | |
$meta_key = 'some_meta_key'; | |
$meta_value = 'bar'; | |
foo( $user_id, $meta_key, $meta_value ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment