Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by Michel Plungjan
at 2024-08-02 23:15:24
Point:500 Replies:12 POST_ID:828675USER_ID:11205
Topic:
PHP Scripting Language;;
Hi
I tweaked something in a call to a function and suddenly I had to change
$items[$i]->title
to
$items[$i]["title"]
I cannot find on google what the difference is in the object I had before and now
I tweaked something in a call to a function and suddenly I had to change
$items[$i]->title
to
$items[$i]["title"]
I cannot find on google what the difference is in the object I had before and now
Expert: duncanb7 replied at 2024-08-03 09:35:25
Hope help you next time in new thread
Duncan
Duncan
Author: Michel Plungjan replied at 2024-08-03 09:30:43
Apologies for not mentioning JSON and for forgetting to split between the explanation of what the difference was and the reason it happened.
Fixed now
Fixed now
Expert: duncanb7 replied at 2024-08-03 09:26:17
Hi
I tweaked something in a call to a function and suddenly I had to change
$items[$i]->title
to
$items[$i]["title"]
I cannot find on google what the difference is in the object I had before and now
I tweaked something in a call to a function and suddenly I had to change
$items[$i]->title
to
$items[$i]["title"]
I cannot find on google what the difference is in the object I had before and now
You just want to know what is different between them
Why you will just gave him the score that is unrelated to the subject ?
What or where is the word inside of your thread for your question about json ?
Please advise how you solve your issue or question exactly with JSON
Easy to score will let other people who read later on and think that is good and
final answer and believe the difference between items is caused by Json
If like json, you will go to make new thread for Json
I never do objection, but feel it is strange...strange than strange
Duncan
Author: Michel Plungjan replied at 2024-08-03 09:17:22
I was sure it was something simple
Author: Michel Plungjan replied at 2024-08-03 09:16:47
Sorry guys for not posting more code. I was sure someone would know immediately what the difference was. I did not have access the the code that broke my script.
I will go with the json_decode part since I did not have control over the code after I plugged it into the PHP that did the web service access. So when I wrote my part, I used a static json string as a mock and when I plugged it into the web service getter, I got the error
I will go with the json_decode part since I did not have control over the code after I plugged it into the PHP that did the web service access. So when I wrote my part, I used a static json string as a mock and when I plugged it into the web service getter, I got the error
Assisted Solution
Expert: Slick812 replied at 2024-08-03 07:39:11
250 points EXCELLENT
greetings mplungjan, , I had the same problem, when I copy and pasted code from another project, and forgot to look at an change the json_decode( ) setting for returning arrays instead of objects, as in
$allArrays = json_decode($json, true);
if you have tweaked your json_decode( ) by adding the TRUE to return arrays then you would get the changes you describe.
$allArrays = json_decode($json, true);
if you have tweaked your json_decode( ) by adding the TRUE to return arrays then you would get the changes you describe.
Accepted Solution
Expert: Ray Paseur replied at 2024-08-03 05:36:23
250 points EXCELLENT
@angelIII: +1 for great minds thinking alike!
$items[$i]->title $items is an array of objects. $i is an index pointing to one object, the resolved variable is the title property
$items[$i]["title"] $items is an array of arrays. $i is an index pointing to one array, the resolved variable is the title element
Man Page References:
http://php.net/manual/en/language.types.array.php
http://php.net/manual/en/language.types.object.php
$items[$i]->title $items is an array of objects. $i is an index pointing to one object, the resolved variable is the title property
$items[$i]["title"] $items is an array of arrays. $i is an index pointing to one array, the resolved variable is the title element
Man Page References:
http://php.net/manual/en/language.types.array.php
http://php.net/manual/en/language.types.object.php
Expert: Guy Hengel [angelIII / a3] replied at 2024-08-03 04:54:36
I presume this is the result of using a different function like mysql_fetch functions ....
Expert: Dave Baldwin replied at 2024-08-03 01:13:23
I don't see $items[$i]->title listed as a valid array syntax. The only place I can find the use of '->' is in accessing objects in a class.
http://us2.php.net/manual/en/language.types.array.php
http://us2.php.net/manual/en/language.oop5.basic.php
http://us2.php.net/manual/en/language.types.array.php
http://us2.php.net/manual/en/language.oop5.basic.php
Expert: duncanb7 replied at 2024-08-02 23:52:41
first, "$items[$i]->title" is point to next object node
for exmaple, you can go to different object node in the following table
$data=getElementsByTagName('table')->item(0)>getElementsByTagName('td')->item(0)->nodeValue;
so $data will be "Firstvalue"
<div>
<table>
</tr>
<td>Firstvalue</td> //1st td node
<td>Secondvalue</td> //second td node
</tr>
</table>
</div>
Second, $items[$i]["title"]
is just arrary of array, double array, nothing special, just google it
So it is different two thing and it is explained here
for exmaple, you can go to different object node in the following table
$data=getElementsByTagName('table')->item(0)>getElementsByTagName('td')->item(0)->nodeValue;
so $data will be "Firstvalue"
<div>
<table>
</tr>
<td>Firstvalue</td> //1st td node
<td>Secondvalue</td> //second td node
</tr>
</table>
</div>
Second, $items[$i]["title"]
is just arrary of array, double array, nothing special, just google it
So it is different two thing and it is explained here
Expert: Marco Gasi replied at 2024-08-02 23:50:33
Sorry, you know it yet, but without the code I really can say nothing more.... :(
Expert: Marco Gasi replied at 2024-08-02 23:49:21
We should see the function code and the function call before and after, but before you were accessing to the object property in standard way, after you are accessing to the object as a multiple array. If you post the code, maybe I'll can give you a better help :)