473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Array value to new instance

N8F0x
1
I want to make every entry of an array to a new instance variable with the same name as the names and values in the array.

Expand|Select|Wrap|Line Numbers
  1.  
  2.     $variables = array(
  3.             array(
  4.             "name" => $row[name],
  5.             "value" => $row[value]
  6.             )
  7.  
  8.         );
  9.         // Printing all the keys and values one by one
  10.         $keys = array_keys($variables);
  11.         for($i = 0; $i < count($variables); $i++) {
  12.  
  13.                foreach($variables[$keys[$i]] as $key => $value) {
  14.  
  15.                /* every key saved as new variable with the same 
  16.                               name as saved in the array and declared with 
  17.                               the same value as in the array, so that I
  18.                               can access the instance like $uniqeVariableInArray = valueOfThisVariable. 
  19.  
  20.                             var $row[name] = $row[value];                 
  21. */           
  22.                }
  23.  
  24.             echo "<br>";
  25.         }
  26.  
  27.  
Jul 31 '18 #1
0 1737

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
$successMsgArray = array('image' => array('add_album' => 'Album: "$album" has been created', 'edit_album' => 'Information for album "$album" has been changed')); I am having to return the...
8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
1
by: JAG | last post by:
I am getting an error using the replace method in one of my functions. I am using the replace method in the mail document function in my frameset .hta to change forward slashes to back slashes in...
11
by: MLH | last post by:
The following procedures found at http://ffdba.com/downloads/Send_Mail_With_Outlook_Express.htm are meant to work together in harmony to effect eMail sends via OE. The last procedure (FN SplitB)...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
1
by: vinodkus | last post by:
dear sir/madam I want to show javascript array value in asp combo. please help me or give me a proper link. Thanks in Advance. Bye
4
by: toadstool | last post by:
I have an array containing the various products $inventory = array(); $inventory = "whatever1"; etc I have an array containing various values $quantity = array(100,200,300); I call in a...
1
by: Mary meer | last post by:
i am trying to switch array value but i get this error message: Undefined offset 2 $at=array( array('Title:','title',2,10), array('First Name:','fname',2,10 ), ...
11
by: Tyler Harder | last post by:
Hello, I'm having some trouble creating a dynamic variable that will load an array value: $this_content_json When I use the above line 'hard coded', it works. But when I use the code below as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.