Hello,
I am looking for some assistance with my PHP code, I have created a simple database lookup and echo using else / if statements but I have been informed that it would be better to use a switch statement. How would i go about changing the code below to a switch?? I am lost.
Here is the code:
I appreciate any tips or hints that can help me improve upon this!PHP Code:<?php
if(ICL_LANGUAGE_CODE=='de')
{
$my_id = 943;
}
else if(ICL_LANGUAGE_CODE=='nb')
{
$my_id = 944;
}
else if(ICL_LANGUAGE_CODE=='sv')
{
$my_id = 945;
}
else
{
$my_id = 909;
}
$post_id_7 = get_post($my_id);
echo $post_id_7->post_content;
?>
With thanks and kind regards
Edd



Reply With Quote


Bookmarks