ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I would like to be able to access the '0' index of the array being returned by array_splice without having to use the temporary variable. I would like something like this:
You kinda lost me, I hardly ever use arrays so I don't know everything they're capable of. I was just wondering why you are using array_splice and update_array in your code. I'm not sure what those functions do exactly.
Just curious, why can't you just use the standard array format:
Code:
<?php
$temp = array('$date', '$index', '1');
?>
Like I said I'm not too familiar with arrays so if you could let me know those other functions do I'd appreciate it.
Originally posted by msound
Like I said I'm not too familiar with arrays so if you could let me know those other functions do I'd appreciate it.
Just an etiquette note, you normally don't reply to someones thread with questions like you asked. If you have questions about these functions specifically, it would be more appropriate to start your own thread and reference my post.
In addition, www.php.net has a wonderful site that documents the language very well.
Hmmm, I thought this was a discussion board, where people came to discuss things. You posted becuase you have a question and you needed someone else's help. But when someone asks YOU for help, you throw this etiquette BS in their face.
Its people like you who bring great online communities like this down. If you aren't willing to share your knowledge with other people, then I hope people refuse to share their knowledge with you. After all, I have a feeling your question could've been answered with a few google searches as well.
What search engines like google lack however is personalization. Discussoin Boards are great becuase in most cases, you can get a good answer for your specific question. Then you can reply with either a thank you, or a follow up question.
But then there are those cases where the person who responds is a big Douche bag. I nomintate mrtwice for the Biggest Douche in the Universe award!
Yeah i think i over reacted just a little. I just come to these forums in the hopes of learning new things and helping other people. When someone gives me a crash course on proper discussion board etiquette I get a little annoyed. I understand how frustrating it can be to have someone hijack your thread but I didn't think my question strayed off topic. Sorry about the whole douche bag thing but that was actually out of an episode of southpark, gotta love southpark...
Actually, the whole point was to have one statement. In addition, I don't understand your code. The point in my code was to take the first element of the array returned by array_splice and assign it to $update_array. It looks to me like your code just gives me the first element of the $data array.
Quote:
Originally posted by msound
Yeah i think i over reacted just a little. I just come to these forums in the hopes of learning new things and helping other people. When someone gives me a crash course on proper discussion board etiquette I get a little annoyed. I understand how frustrating it can be to have someone hijack your thread but I didn't think my question strayed off topic. Sorry about the whole douche bag thing but that was actually out of an episode of southpark, gotta love southpark...
Actually, I don't like Southpark at all and never watch it, but apology accepted.
It was really my intention to help. If you noticed, I posted links that I thought would answer your question about the functions better than I could. And really, the only reason I mentioned anything about etiquette is that your reply was the first one. When I am looking for posts to reply to, I usually look for ones with zero replies first. Hence, posts with no replies get answer faster than those that have already had a reply or two. (if everyone thinks like me )
We are now 7 replies deep and only one of them has anything to do with my original question. Not being a "douche bag" just being overly practical.
Yea, my code was wrong. I read the docs wrong and thought that the return value was the resulting array instead of the removed elements. It's safer to use a temp variable since you can check the size of the array instead of indexing it directly. If you always want the first element you can try:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.