Testing

dsfknsdlk s;lkfjsldkfj ;k’;sdfk ;ojk;klsdf ;lkjsdl;kfjlk

a dba guide

oracle 11g

Linux Commands – A practical reference

Validate an Email Id by Oracle

CREATE OR REPLACE FUNCTION xx_check_email(l_user_name IN VARCHAR2)
RETURN VARCHAR2 IS
l_dot_pos NUMBER;
l_at_pos NUMBER;
l_str_length NUMBER;
BEGIN
l_dot_pos := instr(l_user_name
,’.’);
l_at_pos := instr(l_user_name
,’@’);
l_str_length := length(l_user_name);
IF ((l_dot_pos = 0) OR (l_at_pos = 0) OR (l_dot_pos = l_at_pos + 1) OR
(l_at_pos = 1) OR (l_at_pos = l_str_length) OR
(l_dot_pos = l_str_length))
THEN
RETURN ‘FAILURE’;
END IF;
IF instr(substr(l_user_name
,l_at_pos)
,’.’) = 0
THEN
RETURN ‘FAILURE’;
END IF;
RETURN ‘SUCCESS’;
END xx_check_email;

The Calling of the function:

declare
v_name varchar2(100);
BEGIN
select xx_check_email(‘muni@r@sfsd.hk’)
into v_name
from dual;
DBMS_OUTPUT.PUT_LINE(v_name);
END;

Oracle 9i

PHP file_get_contents() Function

The file_get_contents() reads a file into a string. File_Get_Contents () works the same as file () except it returns a string instead of an array. This function retrieves data from an external file and then puts it into a string for use.

This function is the preferred way to read the contents of a file into a string. Because it will use memory mapping techniques, if this is supported by the server, to enhance performance.
Syntax
file_get_contents(path,include_path,context,start,max_length)

Parameter Description
path Required. Specifies the file to read
include_path Optional. Set this parameter to ‘1’ if you want to search for the file in the include_path (in php.ini) as well
context Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. Can be skipped by using NULL.
start Optional. Specifies where in the file to start reading. This parameter was added in PHP 5.1
max_length Optional. Specifies how many bytes to read. This parameter was added in PHP 5.1

Tips and Notes

Tip: This function is binary-safe (meaning that both binary data, like images, and character data can be written with this function).
Example

The output of the code above will be:
This is a test file with test text.


PHP
munir
PHP Function
PHP GEEK
PHP Tutorial

PHP basename() Function

The basename() function returns the filename from a path.
Syntax
basename(path,suffix)

Parameter Description
path Required. Specifies the path to check
suffix Optional. Specifies a file extension. If the filename has this file extension, the file extension will not show

Example
<?php
$path = "/testweb/home.php";

//Show filename with file extension
echo basename($path) ."
“;

//Show filename without file extension
echo basename($path,”.php”);
?>

The output of the code above will be:
home.php
home

PHP
munir
PHP Function
PHP GEEK
PHP Tutorial

PHP in_array() Function

Definition and Usage

The in_array() function searches an array for a specific value.

This function returns TRUE if the value is found in the array, or FALSE otherwise.
Syntax
in_array(search,array,type)

Parameter Description
search Required. Specifies the what to search for
array Required. Specifies the array to search
type Optional. If this parameter is set, the in_array() function searches for the search-string and specific type in the array

Tips and Notes

Note: If the search parameter is a string and the type parameter is set to TRUE, the search is case-sensitive.
Example 1

The output of the code above will be:
Match found

Example 2
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland", 23);

if (in_array("23",$people, TRUE))
{
echo "Match found
“;
}
else
{
echo “Match not found
“;
}
if (in_array(“Glenn”,$people, TRUE))
{
echo “Match found
“;
}
else
{
echo “Match not found
“;
}

if (in_array(23,$people, TRUE))
{
echo “Match found
“;
}
else
{
echo “Match not found
“;
}
?>

The output of the code above will be:
Match not found Match found Match found

munir hoque in_array php mysql

Thanks Full