Answers for "unset php"

PHP
5

php unset array key

unset($dataArray['key']);
Posted by: Guest on June-01-2020
2

destroy php variable

<?php

$first = 100;
$second = 200;

$third = $first + $second;
echo "Sum = ".$third;
// Destroy a variable with unset function
unset($third);

//after delete the variable call it again to test
echo "Sum = ".$third;
?>
Posted by: Guest on August-23-2020
2

php unset reference

$ref = &$var;

unset($ref);
Posted by: Guest on June-01-2020
3

php unset

// Destroy a variable
<?php
unset ($var1, $var2.... )
?>
Posted by: Guest on April-14-2020
0

php delete

<?php
$servername = "localhost";
$username = "username";
$password = 
	"password";
$dbname = 
	"myDB";

// Create connection
$conn = 
	new mysqli($servername, $username, $password, $dbname);

	// Check connection

	if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);
}


	
// sql to delete a record

	$sql 
	= "DELETE FROM MyGuests WHERE id=3";

	
if ($conn->query($sql) === TRUE) {
    echo "Record 
	deleted successfully";
} else {
    echo 
	"Error deleting record: " . $conn->error;
}

$conn->close();

?>
Posted by: Guest on January-26-2021
0

unset php

//remove variable
unset($var1,$var2,$var3;
//remove array
unset($array['$key']);
Posted by: Guest on October-08-2021

Browse Popular Code Answers by Language