Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change a value in a repeated item #11

Open
shiningstarpxx opened this issue Feb 19, 2015 · 0 comments
Open

How to change a value in a repeated item #11

shiningstarpxx opened this issue Feb 19, 2015 · 0 comments

Comments

@shiningstarpxx
Copy link

for example

1 message UserItem
2 {
3 repeated int32 nums = 1;
4 }
5
6 message User
7 {
8 repeated int32 data = 1;
9 optional UserItem item = 2;
10 }

12 include('test.proto.php');
13
14 $u = new User();
15
16 for( $i = 0; $i < 2; $i++ )
17 {
18 $u->appendData($i);
19 }
20 echo $u->getData(1)."\n"; // 1
21 echo $u->getData(0)."\n"; // 0

if I want to change $u->data[1] = 100, what should i do?
I have no idea, and i am looking forward to your answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant