Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5953

Re: First question and introducing myself

From Shake <QUITAESTO@QUITAESTO.NOES>
Newsgroups comp.lang.php
Subject Re: First question and introducing myself
Date 2012-05-11 10:47 +0200
Organization A noiseless patient Spider
Message-ID <joijn4$krf$1@dont-email.me> (permalink)
References <jogm85$5m5$1@dont-email.me>

Show all headers | View raw


First, Thanks, Jerry Stuckle and Denis McMahon, for your help.

Jerry, your code doesn't do what I want/need, but gave me some 
interesting clues :)

Denis, I am not sure if you're code does, but I guess yes it does.

After your messages, I get this code that does just what I want:

<?
function setArrayPathValue($arrayPath, $src, & $dst)
{
   foreach ($arrayPath as $index) $src = $src[$index];

   // Here I could validate $src

   $result2 = & $dst;
   while(!empty($arrayPath))
   {
     $result3 = & $result2;
     $index = array_shift($arrayPath);
     if(!isset($result3[$index])) $result3[$index] = array();
     $result2 = & $result3[$index];
   }
   $result3[$index] = $src;
}

$dato['ruta']['a']['un']['dato'] = 'contenido';
setArrayPathValue( array('ruta','a','un','item'), $dato, $_SESSION );

print_r($_SESSION);
?>


Thanks

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

First question and introducing myself Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-10 17:18 +0200
  Re: First question and introducing myself Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-10 15:29 -0400
  Re: First question and introducing myself Denis McMahon <denismfmcmahon@gmail.com> - 2012-05-10 22:05 +0000
  Re: First question and introducing myself Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-11 10:47 +0200
    Re: First question and introducing myself Denis McMahon <denismfmcmahon@gmail.com> - 2012-05-12 21:40 +0000
      Re: First question and introducing myself Shake <alex.estevezQUENO@QUENOfilnet.es> - 2012-05-13 23:27 +0200

csiph-web