NYCPHP Meetup

NYPHP.org

[nycphp-talk] Mind exploded on this one!

Nunez, Eddy enunez at tiaa-cref.org
Fri Jul 11 16:02:23 EDT 2003


I didn't think of using compact() ... cool function!!
----------------------------------------
Use compact() on ALL your arrays and you can do this:
 
print $arrayListArray['booleanNonFormVars']['hasSelectedLetter'];
print $arrayListArray['profileNonFormVarArray']['letter'];

not sure if that's what you really want, but it's as clean as you're going
to get.
 
Huh? I didn't try but this can't possibly be valid PHP: ${$val[$j]} = 0;

-Eddy 

-----Original Message-----
From: Phil Powell [mailto:soazine at erols.com]
Sent: Friday, July 11, 2003 3:36 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Mind exploded on this one!


IN that case, Eddy, how about this, THIS works:
 
$booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile',
'hasSelectedProfile',
                             'hasEditedProfile', 'hasDeletedProfile',
'willDeleteProfile',
                             'willDeletePic');
 $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season',
'profilememberid');
 $profileVarArray = array('firstname', 'lastname', 'city', 'state',
'country', 'favebands',
                          'faveconcert', 'favescandinavia', 'faveviking',
'favemeat',
                          'freetime', 'thingslove', 'thingshate',
'favebibleverse',
                          'changeonething', 'maritalstatus', 'birthday',
'favemovie', 
                          'faveplace', 'favetv', 'imgpath', 'imgext');
 $profileNonFormVarArray = array('profileName', 'letter', 'name');
 
 // COMPACT ARRAYS INTO 2-DIMENSIONAL ARRAY arrayListArray
 $arrayListArray = compact('booleanNonFormVars', 'booleanVars',
'profileVarArray', 
                        'profileNonFormVarArray');
 
 // I COULD NOT POSSIBLY EVER EXPLAIN THIS.. ASK HANS ZAUNERE OF NY PHP TO
EXPLAIN IT FOR YOU
 foreach ($arrayListArray as $key => $val) {
  for ($j = 0; $j < sizeOf($val); $j++) {
   if (preg_match('/^boolean/', $key) && strlen(${$val[$j]}) == 0)
${$val[$j]} = 0;
   if (!preg_match('/^boolean/', $key) && strlen(${$val[$j]}) == 0)
${$val[$j]} = '';
  }
 }
 
Phil

----- Original Message ----- 
From: Nunez,  <mailto:enunez at tiaa-cref.org> Eddy 
To: 'NYPHP Talk' <mailto:talk at lists.nyphp.org>  
Sent: Friday, July 11, 2003 3:33 PM
Subject: RE: [nycphp-talk] Mind exploded on this one!


Sorry but...
this won't work because 'hasSelectedLetter' and 'letter' aren't array keys 
they're just values in the arrays.
 
-Eddy
 
-----Original Message-----
From: Jon Baer [mailto:jonbaer at jonbaer.net]
Sent: Friday, July 11, 2003 3:23 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Mind exploded on this one!



echo $booleanNonFormVars['hasSelectedLetter'];
echo $profileNonFormVarArray['letter'];
 
- jon

pgp key: http://www.jonbaer.net/jonbaer.asc
<http://www.jonbaer.net/jonbaer.asc> 
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47
 
 

----- Original Message ----- 
From: Phil  <mailto:soazine at erols.com> Powell 
To: talk at lists.nyphp.org <mailto:talk at lists.nyphp.org>  ;
php-general at lists.php.net <mailto:php-general at lists.php.net>  
Sent: Friday, July 11, 2003 11:21 AM
Subject: [nycphp-talk] Mind exploded on this one!

$booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile',
'hasSelectedProfile',
                             'hasEditedProfile', 'hasDeletedProfile',
'willDeleteProfile',
                             'willDeletePic');
 $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season',
'profilememberid');
 $profileVarArray = array('firstname', 'lastname', 'city', 'state',
'country', 'favebands',
                          'faveconcert', 'favescandinavia', 'faveviking',
'favemeat',
                          'freetime', 'thingslove', 'thingshate',
'favebibleverse',
                          'changeonething', 'maritalstatus', 'birthday',
'favemovie', 
                          'faveplace', 'favetv', 'imgpath', 'imgext');
 $profileNonFormVarArray = array('profileName', 'letter', 'name');
 
 $arrayListArray = array('booleanNonFormVars', 'booleanVars',
'profileVarArray', 
                        'profileNonFormVarArray');
 
Bluntly put, I need to get: 
$hasSelectedLetter
$letter
 
Etc..
 
I have absolutely NO idea how to do this, help!
 
Phil



  _____  




_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk




**************************************************************
This message, including any attachments, contains confidential information
intended for a specific individual and purpose, and is protected by law. If
you are not the intended recipient, please contact sender immediately by
reply e-mail and destroy all copies. You are hereby notified that any
disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************




  _____  




_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk




**************************************************************
This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law.  If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies.  You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030711/1d928e7b/attachment.html>


More information about the talk mailing list