Array parse error

Hi,

Here’s my code. It gives me a parse error when it encounters the : (colon) on $PM2=$test[$i]->DE:Printer M; line. The DE:Printer M cannot be changed in the array, it is named as is. What’s the best way to get past it, I do need the data for DE:Printer M. Thanks.

[php]
$test=$client->get($newpath,array(‘DE:Printer M’));
for ($i=0; $i<min(300, sizeof($test)); $i++) {
$PM2=$test[$i]->DE:Printer M;
[/php]

You would be better off telling the problem you are trying to solve rather than your attempt at solving it. As far as the array, start with the most basic part;

[php]<?php
$array = array(‘DE:Printer M’);
print_r($array);[/php]

I’ve used the codes with other variables that don’t have special characters so I’ll try to see if I can explain it a bit better.

The contents of $test would be similar to
{
ID: 12345w2
DE: Printer M: 123ab
}
{
ID: 1234a23
DE: Printer M: xew2
}

So where I have however many results in $test, I want to see each entry for DE:Printer M data.

So based on the original code, if I have 50 sets from $test, I want to see each entry for DE:Printer M data and work with that string/data for something else.

Let’s start from the beginning. Where is this data coming from? A database? Post your data source. If it is in a DB, post an SQL dump.

And then post EXACTLY what the task/problem is you are trying to solve, not your attempt at solving it. “Work with” and “something else” tell me absolutely nothing.

This is a classic XY Problem.

Sponsor our Newsletter | Privacy Policy | Terms of Service