kvarnerexpress
Oct 3 2005, 01:12 PM
Have been trying to solve this for a long time now, so I thought Iīd give you guys a chance to break it! I want to remove an object from an array that I store in a Session object. Iīve written a function that takes an array and an id as parameters. Checks if one of the objects has the id I want to remove and then itīs supposed to remove it. Quite simple, thatīs why I cant see why it doesnt work! Hereīs the code: CODE function Remove_prod($id2,$AL) { print_r($AL); foreach ($AL as $prod) if($prod->id == $id2) { echo "REMOVING!<p><p>"; unset($AL[$prod]); }
print_r($AL); return $AL; }
I get the same data before and after the execution of the code. I know that the unset function is executed but no value is changed. So, what say you? Thanks in advance! kvarnerexpress
Reply
arboc7
Oct 5 2005, 02:12 AM
I would suggest that you actually read the PHP documentation about the unset() function. Here's the link: http://us3.php.net/manual/en/function.unset.phpHope this helps some~
Reply
Spectre
Oct 5 2005, 03:46 AM
Note the line: CODE if($prod->id == $id2) The '$prod' variable is not an object, yet here you are treating it as if it were. This would cause problems. I'm not sure exactly what 'id' is supposed to be, but if the array '$AL' contains arrays within itself, each with an inded 'id', try replacing '$prod->id' with '$prod['id']'. It would help a lot if you could give an example of the structure of the '$AL' array. How many dimensions, is it numerically or associatively indexed, what is the data it contains, etc. A simple var_dump() would be sufficient.
Reply
Recent Queries:--
array unset - 1110.53 hr back. (1)
Similar Topics
Keywords : remove, objects, array, unset
- Warn?
how to remove it (3)
Usb Disk Ejector
The Quick Way to Safely Remove USB Drives (16) looking for a way to safely remove usb drives... QUICKLY? /tongue.gif"
style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> here's the USB DISK
EJECTOR for you! it's a small utility that does the same thing as the Windows "Safely
Remove Device" applet, except that it does it quicker and better. there is no installation required,
it's flexible (can run BOTH via command line, and GUI), it's portable, and most importantly,
it's a freeware! /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
alt="biggrin.gif" /....
Array Pointers Can Be Backwards
(Kind of) (8) I just found this out today: When you're using arrays, when you reference a certain index, you
can switch the pointer and the subscript around. I know I'm not explaining that very good, but
here's and example: CODE int a[] = {1,2,3,4,5,6,7,8,9,10,11}; int b =1; int
c[] = {0,-5,11,0,0,5,0,0,0}; cout << b[a][c]; //Same as
c[a[b]]; See? 'b' is actually just an integer, it's not an array,
or pointer, or anything. Usually, you would have to put the array first, then an integer. Like....
[ruby]lite Multi-dimensional Array
(0) Hey everyone, What I have here is a really simple Multi-Dimensional Array class. This is a Lite
version with only very basic features. It supports 2- and 3-Dimenional Arrays, and it only really
has capabilities for storing and accessing data. I am working on a fully featured version of the
class, but it's going in a game engine I am working on that I'll hopefully be selling
licenses for, so it would do no good to release all the classes in it. /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> This class has relatively
good p....
Bryce 5 --- Boolean Objects
(0) Description Learn to create super sexy booleans with Bryce. This skill will increase your 3D
capabilites, an improve your artistic, or design skills over all. As well it enables you to turn
basic shapes into more complex shapes, allowing you to create more realistic, or even funkier
images/objects than you would have been able to previosly. FINISHED PRODUCT Try It Out
Alright, as this is only a tutorial, we'll be starting with something quite simple. On the
object tool bar, select the sphere twice. After these spheres have been created, move them so the....
Remove A Value From A Php Array Based On Its Value
(5) I have an index array CODE $array[0] = 10; $array[1] = 12; ...
Its kinda late and I'm falling asleep now but I had a quick look through PHP.net, and could not
find what I'm after, Maybe I'm too sleepy, sorry, but if anyone knows off the top of their
head a way to removed members in that array based on its value, i.e. I wanna remove values 12. I
don't really want to do a loop but if I cant find any existing function to do it, then I may
have to. Thanks for any help.....
Remove 'posts In Topic'
(3) I have gone through any options related to this in my control panel, but it still is here! So
my question is... how do you remove that 'posts in topic' thing. I would really like to read
other people's post without wasting a lot of time, because i normally go on trap17 in my free
time and I don't have much free time anyway. I am a bit less active on trap17 just because of
that, for me, it is a deterrent for posting. I apologize if I have insulted any of the admins/mods
that installed this feature to save bandwidth or something, but can there atleas....
How To Remove Warning
(3) My hosting req. is denied because of the one warning i have. How can I get rid of this warning? If
there is any way please tell. Otherwise I cannot hope to get hosting. Thanx.....
Php Objects: Catchable Fatal Error
There is a weird problem with objects in php 5.2.2 (4) in php 4.4.7 my code seems to be ok but in later version 5.2.2 i get this error Catchable fatal
error: Object of class mission_rank could not be converted to string in
/Applications/xampp/xamppfiles/htdocs/nexus/includes/forms/cn_reload.php on line 41 cn_reload.php
include('../class/userClass.php'); session_start(); $app_user =&
$_SESSION ; if ($app_user->character != false) { $race_letter =
array('H','E','T','M','G'); $cn_id = 0; foreach
($app_user->character as....
Flash - Streaming Flv With Interactible Objects
Actionscript 3.0 - syncronising swf with flv (3) Hi Guys, I am trying to make a flash based web site. The idea is to have a flv video streaming
which has people moving around and the people need to be clickable objects. I tried tracing the
video by importing the flv to the flash time line and creating a button that follows a person in
each frame. I then remove the flv video from the timeline and stream it using actionscript. This
leads to synchronization issues. Does anyone know if this combination of swf and flv has ever been
implemented? If so could you please refer me to the source or post a link to an example, i....
How Do I Remove The Iframes Scrollbars?
(5) Hello. My Iframes are not working properly at the moment. I have some problems with removing the
scrollbars. I also need them to automatically extend, without that I need to change the height and
width. I have tried with 100% and auto , but there must be something I am doing wrong. (I do not
know much HTML, really.) I will explain a bit more. On my front page, I have an Iframe linked to my
blog, and other things. And as I have said, I need to remove the scrollbars and so on... Here is
the code I am using. (Of course "URL1" is replaced with my url.) CODE <ifr....
Special Wii Javascript
New Javascript Objects for Wii (2) I found on Nintendo.com a while back some new javascript objects dealing with the Wii Remote. I
have decided to post a link to these new Javascript objects here. Wii javascript These new
Javascripts can detect whether or not a Wii Remote is enabled, the position of the pointer, and even
the tilt of the remote. It also has an object that determines the keypress of the Wii. These can be
very useful for Wii sites. Maybe have a menu load with AJAX when the remote is tilted. Add button
functionality such as when the A and B button are pressed, the form is submitted. Just....
How To Remove Pagefile After Windows Shutdown
(0) How to remove PageFile after Windows Shutdown 1- Go to Start Menu > Click on Run and then type
"regedit" and press ok to run Windows Registry Editor 2- Go to following Address: CODE
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory
3- In the right panel double click on ClearPageFileAtShutdown and give it value of 1 4- Close
Windows Registry Editor and restart your computer. Note: incorrectly editing registry entries may
cause several damages, please create a back up from your registry entries.....
Getting An Array Value Of A Dynamic Variable
(9) Ok i can't believe I need help in php but I can't figure this out... If i have an array,
lets say called test, how do i get a certain value from that array when referencing it dynamically
by either a string or another variable? Example: CODE $test=array(1,2,5);
$name="test"; //Doesn't work: echo $$name[0]; /Doesn't
work: echo ${$name}[0]; ....
How To Remove All Programs From Start Menu
(1) How to remove ALL PROGRAMS from Start Menu 1- Click on Start menu > click on RUN and type
"regedit" and then press OK to open Windows Registry Editor. 2- Go to following address: CODE
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies
3- Create a new DWORD and name it as "NoStartMenuMorePrograms", and give it value of 1 to remove
All Program from Start Menu. 4- Close Windows Registry Editor and restart your computer. Added
later: how to Remove default icons from Start menu To Remove default icons such as My Docu....
Using Multiple Selection Array In Table To Order Data
Using multiple selection array in table to order data (1) have a form that has a multiple select choice, like this: CODE <form method="post"
action="display.php" <select multiple name="selectsort[]">
<option value="code">Code</option> <option
value="amount">Amount</option> <option value="dateammended">Date
Ammended</option> <option value="expreviewdate">Expiration/Review
Date</option> <option value="effectivedate">Effective Date</option>
<option value="e....
Teach Me How To Remove A Portion In This Picture
Graphics Help (5) Can someone guide me here? I need to remove the text saying 'Burn the fat guarentee' To
put my own. Can someone teach me how to do this? Topic title that has "...help" isn't a proper
way to name a topic. ....
What Is A Fibonachi's Array?
Deffinition about Fibonachi's array (5) Fibonachi's array is a mathematical array noticed in a lot of chemistry, science and biology
advents. It is an array of numbers which addend of two before numbers give next article of array,
but this rule doesn't apply for first and secon article 1 and 1. Appearance of array: 1, 1, 2,
3, 5, 8, 13, 21, 34, 55, 89, 144... Array got name per Italian mathematician Fibonachi.....
How To Manually Remove Viruses!
a short tutorial (8) How to manually remove viruses! Have you ever been in the possition that you know you have an
virus but you dont have any antivirus?? Its almost impossible to remove it manual without knowing
about a few tips & tricks. After reading this turtorial im sure you will know how to manual remove
most of the virus lurking around. But that dosnt mean you shouldnt have any anti virus on you
computer! Anyway, lets get starting with the turtorial.. I suppose you already know what safe
mode is. If you dont try pressing the F8 key some times when you start your computer. Y....
Software To Remove Voice?
(10) I am looking for a free software which is able to remove a voice in a song? To just keep the tune,
something similar to the karaoke, I do know that not many songs provide only the tune for which
there isn't any singing. I have been searching for quite some time as well, but the programs I
found did not do just that. I have also read about how impossible it is to achieve with the programs
because they only filter out some frequencies and it isn't possible to filter out to the point
that only the instrumental part of the song is heard. But nonetheless, I hope someo....
Array Problem
(4) I'm having trouble with an assignment for my data structures class.
I have to simulate a
card player getting a a pile of 52 cards (a full deck).
....
How Do I Completely Remove Trojan Viruses
anti-virus put them in virus vault (32) I have AVG anti-virus on my PC, and a few weeks back it found a trojan virus on my pc. It put it
into the virus vault but could not heal it. How do I completly remove a trojan virus? Or even can
I? Do I have to download specific software to remove it, or is there some more complexe way of
going in to the system?....
Remove Spots From Pimples From Face
fable or really the solution to get rid of those ugly (19) I would really want an even skin in my face. I have cicatrices and spots. Guess what I heard?!
Those spots from sqeeuzed pimples in your face, can be removed with a cream used for piles!!
This is something I heard for many times now... It's weird but is this true????????????....
Forgot Password To Trend Micro Internet Security
Is there a way to remove it? (6) One day I was bored so I set a password for our Web security software, Trend Micro Internet
Security. I turned on the URL filter, and now, whenever my friends send me something funny that has
no porn or anything in it, I get the Blocked error. I am really annoyed by this; I can't change
other setting in the software too. Is there any way to either reset the password or remove it,
without uninstalling Trend Micro?....
Which Anti-virus Program Remove Bloodhound?
Anti-Virus that can remove bloodhound (10) Yesterday I was surfing the net and new virus was detected in my computer, its called
w32.bloodhound. Currently I am using Nortong Antrivirus Corporate edition version 9. This program
detect the virus but was not able to remove it. IF you people have encountered this virus? what
program or anti-virus did you used? Also there I have found a program in my add remove program
called BullEyeNetword and I can't remove the program. Can you please give me hint on how to
handle this kind of anoying program and virus? Thanks in advance I am hoping for your friendly he....
How To Remove Download Trojan Virus
(13) My computer is infected with download trojan virus, norton was able to detect and delete the files
but it's still there.....
How To Detect And Remove Mp3 Duplicates
Software for search mp3 duplicates on hard disk (14) Plagiarized post. Quotes added. Link below. ? great software for detecting mp3 duplicated is here
http://abeetech.com/mp3-duplicates-finder/ Description: QUOTE The purpose of this program is
to find all mp3 duplicates on your computer and remove useless files from your hard drive. As this
program performs just this single task it copes with it much better than other more universal
programs. Unlike the other programs for duplicate files search, our program works only with mp3
files. This allows using specific methods for duplicates detection. While most of dupl....
How To Remove Ie Completely
(20) I use both IE and Firefox.. but having some problems with firefox's plug-ins like flash and
several other problems.. so i want to uninstall IE compeletely from my PC.. anyone out there can
help me with it?? thanx....
How To Remove 4 Different Msn Messenger Virus's
cute.pif, PIC1234(1)(1)(1)(1)(1)(1).exe, Choke.exe, and W.. (34) Ok he is a little guide to removing 4 types of the MSN Messenger virus from you PC. First of all,
cute.pif it sends all people on your buddy list this QUOTE omg this is funny! *link to
download cute.pif from jose.rivera4.home.att.net* Here is how to remove it... 1. Hit
Ctrl,Alt,Delete on the keypad, look for "hotkeysvc." select it and press "End Task" (if it is on
there...). 2. Use the Search feature to look for "hotkeysvc.exe". It will be in the %System%
directroy, if it is there at all. Delete that file. 3. Go to Start> Run> msconfig 4. Click the
tab at....
Spybot Search & Destroy
how to remove dso exploits within spybot (3) I found this on my travels & thought it might be helpful smile2.gif If you have the latest Internet
Explorer version and all your Windows Updates, you can safely ignore the DSO Exploit as a potential
problem when Spybot Search and Destroy or other spyware removal tools discover it. However if you
would rather fix the exploit so it does not show up again, follow these steps to edit your Windows
Registry. Please be careful however, incorrect changes to the Windows Registry can cause Windows to
not boot. 1) Make a note of the location of the exploit shown in Spybot, somet....
Looking for remove, objects, array, unset
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for remove, objects, array, unset
*MORE FROM TRAP17.COM*
|
advertisement
|
|