Link | array_flip |
Author | Jason Huck |
Category | Array |
Version | 8.x |
License | http://opensource.org/licenses/artistic-license.php |
Posted | 16 Jan 2006 |
Updated | 17 Jan 2006 |
More by this author... |
Lazy way to reverse the order of key/value pairs in a pair array.
var('unflipped') = array( 'a' = 1, 'b' = 2, 'c' = 3 ); var('flipped') = array_flip($unflipped); $flipped; -> (array: (pair: 1 = a), (pair: 2 = b), (pair: 3 = c))
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag( 'flip', -namespace='array_', -required='in', -type='array', -description='Returns the given pair array with the keys and values inverted.' ); local('out' = array); iterate(#in, local('i')); #out->insert(#i->second = #i->first); /iterate; return(#out); /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft