Questions tagged [unset]

Removing the value associated with a variable or property from the current environment.

Common usages:

  • Destroying a variable or member of an array in PHP.
  • Removing the value bound to a property in Apache Ant.
  • Removing a variable from the environment of a shell script.
595 questions
-1
votes
3 answers

How to unset values from an array in php?

I have a json array look like this…
Naveenbos
  • 2,532
  • 3
  • 34
  • 60
-1
votes
1 answer

New to JSON - trouble with unset/clear/delete json array

Currently trying this: unset($jsonArr-[$json]); but I get this error: Parse error: syntax error, unexpected '-', expecting ',' or ')' This has to be simple to do. I've been searching for an answer to this for hours. I think I've tried everything…
-1
votes
1 answer

Unsetting array values in a foreach loop not working properly when array length is large

Hello all i have major problem, i have an array with length greater than 4000. In a foreach loop i tried to unset each key but its not working properly. $arr=array( 0 => '365-pramo@mageos.com', 1 => '365-pram@mageos.com',`.....` 4000 =>…
Pramod
  • 1,031
  • 3
  • 13
  • 26
-1
votes
1 answer

Unset element array key not known

I have the following array output. For example i want to unset index 16. I do unset unset($row[0][16]); But now i dont know the index 16. How can i unset it by ifelse "oude prijs" ? Array ( [0] => Array ( [0] => productname [1]…
Bas
  • 2,330
  • 4
  • 29
  • 68
-1
votes
2 answers

Array for-loop and remove button php

I have this code:
'; if(isset($_POST['remove'])){ …
-2
votes
2 answers

Unset a php value on each run of for each

I am running the following script, which is phpmailer, at the end of each for each run I want it to clear the contents of $name , either that or $row->['leadname'] , I have tried using unset at the bottom of the script but this seems to have no…
Iain Simpson
  • 441
  • 4
  • 13
  • 29
-2
votes
1 answer

Unset() value from PHP Array To Prevent Print Out To Screen

I'm a jr developer working on a wordpress plugin that uses an API to retrieve data for the site. Within the API call are latitude and longitude values for the Google maps API on the same page. There is a for loop to print each provided value from…
mudpain
  • 3
  • 2
-2
votes
1 answer

Laravel MongoDB unset use?

{ "_id": { "$oid": "60b609d6bd846108dc86433d" }, "il": "Siirt", "ilce": "merkez", "ada": 466, "parsel": 1, "pafta": "M47-B-09-B-3-A", "tkgmkodu": "106478407", "tkgmeskikodu": [], "nitelik":…
DUPi
  • 11
-2
votes
1 answer

How can I unset $_POST data so that it does not resend after submit when i refresh the browser?

After submit, if i refresh the page, it does sends the submitted data again. I do not want that to happen, i want the posted form variable () to be cleared completely after sending. Can someone help me get that done? Here's my code: …
kc melec
  • 17
  • 4
-2
votes
1 answer

Unset URL parameter values in wordpress

unset m=1 parameter values to null abc.com/s=hotels&m=1 I have tried to unset using this code function resetM() { if( isset( $request['m'] )){ unset( $request['m'] ); } return $request; } add_filter('resetM','request'); i want…
uDAY
  • 21
  • 1
  • 5
-2
votes
1 answer

remove $_SESSION var but not its content in php

$session = &$_SESSION; I acces $_SESSION by this var: $session; How can I remove $_SESSION var without deleting its content ? I want to can acces session data only from $session var. Can you please give me any solution? Note: I don't need to know…
-2
votes
1 answer

Use of unset and count with arrays

I have a array that contains other arrays with each user's details in. For example: $_SESSION["ActQueue"] = [["J.Paul", "John", "Paul", "0000-00-00 00:00:00"],["J.Bloggs", "Joe", "Bloggs", "0000-00-00 00:00:00"]] I have written a bit of code that…
Thomas Smyth
  • 512
  • 3
  • 9
  • 36
-2
votes
1 answer

How can I unset a line in PHP after pressing a submit button?

I have this code now, but whenever I get to the page my entire text.txt file gets deleted. I am using sessions to get the information from a page from another php document. This is the 3rd page it directs to after information is input. I would like…
PHPnewb
  • 43
  • 1
  • 6
-2
votes
3 answers

Check all value of specific index in array object is Null or not?

I have one array object in php. I want to unset all index which contains null value for all inside objects. example : $data like Array ( [0] => Array ( [address] => 123 [address1] => asddff [address3] => …
Lahar Shah
  • 7,032
  • 4
  • 31
  • 39
-2
votes
1 answer

delete data from array

I have this issue with deleting a data from an array(session). Well, my code is: $cart = $this->session->userdata('cart'); $sess_product_name = $cart['product_name']; $sess_prod_id = $this->input->post('sess_prod_id'); foreach($sess_product_name as…
Grig Dodon
  • 63
  • 1
  • 7
1 2 3
39
40