[ create a new paste ] login | about

Link: http://codepad.org/diDxHLmS    [ raw code | output | fork | 9 comments ]

PHP, pasted on Mar 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$data = array(array(
	"transaction_no" => 123,
	"transaction_date" => "Old value"));

echo "Before Update loop\n-------------------------------\n";
echo "<pre>";
print_r($data);
foreach($data as $key => $value)
{
  $data[$key]['transaction_date'] = "New Value";
}
echo "After Update loop\n----------------------------\n";
echo "<pre>";
print_r($data);


Output:
Before Update loop
-------------------------------
<pre>Array
(
    [0] => Array
        (
            [transaction_no] => 123
            [transaction_date] => Old value
        )

)
After Update loop
----------------------------
<pre>Array
(
    [0] => Array
        (
            [transaction_no] => 123
            [transaction_date] => New Value
        )

)


Create a new paste based on this one


Comments:
posted by sdasdad on Mar 4
<?php
$data = array(array(
"transaction_no" => 123,
"transaction_date" => "Old value"));

echo "Before Update loop\n-------------------------------\n";
echo "<pre>";
print_r($data);
foreach($data as $key => $value)
{
$data[$key]['transaction_date'] = "New Value";
}
echo "After Update loop\n----------------------------\n";
echo "<pre>";
print_r($data);
reply
posted by iliyasfusion on Jun 16
sadad
reply
posted by iliyasfusion on Jun 16
asd
reply
posted by iliyasfusion on Jun 16
asdsadasd
reply
posted by iliyasfusion on Jun 16
dasdasdasdsadsadasd
reply
posted by shubham735 on Jan 1
<script>alert()</script>
reply
posted by fdfd on Sep 5
cd
reply
posted by fdfd on Sep 5
fdfdfd
reply
posted by shubham735 on Jan 1
<script>alert(1);</script>
reply