473,547 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array value to new instance

N8F0x
1 New Member
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 1742

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

Similar topics

1
1740
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 following in a class method: return $successMsgArray;
8
10204
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 it is assigned a text literal?? HOW can I change the array value to upper case then? What other method exists for arrays? Ex: var GridArrayName1...
1
1990
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 the myVar string. The myVar string is obtained in my show document function: myVar = filename; In my mail document function:
11
1936
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) fails on its last line which is meant to assign the value of SplitB (a variant) the value of aSplit (an array dim'd as variant). That fails due to...
4
4329
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 "selectedValues" from next page for php variable this is my javascript code saved on "sendValue.js" file, <script> function...
1
1650
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
4230
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 value from a form $_POST; say I assign a variable
1
2834
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 ), i have foreach loop foreach($at as $v){ switch ($v){
11
2909
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 a dynamic variable, it fails: ${ 'this_content_json' } Any help would be muchos appreciados.
0
7510
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7463
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7797
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1923
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.