Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Medio=''; //variable to handle the result
- $MedioPago='12345'; //variable with numbers given
- $chars = str_split($MedioPago); //split the numbers
- foreach($chars as $char)
- {
- if($char=='1')
- {
- $Medio.='"codigo": "01",'.PHP_EOL;
- }
- else if($char=='2')
- {
- $Medio.='"codigo": "02",'.PHP_EOL;
- }
- else if($char=='3')
- {
- $Medio.='"codigo": "03",'.PHP_EOL;
- }
- else if($char=='4')
- {
- $Medio.='"codigo": "04",'.PHP_EOL;
- }
- else if($char=='5')
- {
- $Medio.='"codigo": "05",'.PHP_EOL;
- }
- }
- $Medio = rtrim($Medio,',');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement