I have the following array:
$this->uploaders = array(
'yt' => 'Youtube',
'hl' => 'Hulu',
'fd' => 'Funny or Die'
);
In my script the following:
substr($uploader->external_id, 0, 2);
will always return either 'yt', 'hl' or 'fd'. I need to do a check to see which one it matches and return the value from the above array.
For example if
substr($uploader->external_id, 0, 2)
returned "yt" I need it to return "Youtube". How can this be done?
I think you're looking for:
$type = substr($uploader->external_id, 0, 2);
$longName = $this->uploaders[$type];
$longName will contain 'Youtube' if substr($uploader->external_id, 0, 2) contains 'yt'
0 comments:
Post a Comment