[UPHPU] Help me simplify this bit of code please?

Craig Jackson tapocol at gmail.com
Mon Aug 25 13:38:23 MDT 2008


// Adds a slash before the first to characters of the string.
$series_description = '/'. substr($series, 0, 2);
// Gets the remaining characters after the first two characters.
$series_year = substr($series, 2);

Craig

On Mon, Aug 25, 2008 at 1:31 PM, Ash <ashovi at qwest.net> wrote:
> switch ($series)
>                {
>                case 'FF12':
>                        $series_year = "12";
>                        $series_description = "/FF";
>                break;
>
>                case 'FF13':
>                        $series_year = "13";
>                        $series_description = "/FF";
>                break;
>
>                case 'FF14':
>                        $series_year = "14";
>                        $series_description = "/FF";
>                break;
>
>                case 'FF15':
>                        $series_year = "15";
>                        $series_description = "/FF";
>                break;
>
>                case 'FF16':
>                        $series_year = "16";
>                        $series_description = "/FF";
>                break;
>
>                case 'FF17':
>                        $series_year = "17";
>                        $series_description = "/FF";
>                break;
> etc,
>
> Is there a way to just have it read the series and then make $series_year
> and $series_description equal what it is supposed to?
>
> Ash
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>


More information about the UPHPU mailing list