Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $array = array('10|20|30|');
- $szamok = array();
- $seged;
- $len = strlen ( $array['0'] );
- echo 'Tömbelem mint string: <br/>'.$array['0'];
- for ($x = 0; $x != $len; $x++) {
- if($array['0'][$x] != '|'){
- global $seged;
- $seged = $seged.$szam = $array['0'][$x];
- }else{
- $seged = $seged;
- //echo 'seged:'.$seged.' <br/>';
- array_push($szamok, $seged);
- $seged='';
- }
- }
- echo '<hr/>';
- echo 'Tömbelem elemekre szedve hashtagokkal: ( | )<br/>';
- function muvelet($operator, $szam){
- if($operator = '+'){
- $eredmeny = $szam + $szam;
- return $eredmeny;
- }
- }
- for ($x = 0; $x != count($szamok); $x++) {
- $szam = $szamok[$x];
- settype($szam, "integer");
- //echo $szam.' + '.$szam.'='muvelet($)'<br/>';
- echo $szam.'+'.$szam.'='.muvelet('+', $szam).'<br/>';
- echo '<pre/>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement