Why overloading concept is not supported in PHP
PHP is a loosely typed language.
Because variables data type can be vary, :)
How to reverse given string without using built in functions?
<?php
$str_name='Sachin Tendulkar';
$len=strlen($str_name);
//echo $len;
$i=$len;
for ($i;$i>-1;$i--)
//$i>-1 because in array Ist element is start with 0th position.
{
echo $str_name[$i];
}
?>
How do you upload videos using PHP & MySQL
For uploading videos you need not store the video in database. Just you store the video path in database. You store the videos in a separate folder like video_uploads. After uploading you can call tho...
For uploading videos you need not store the video in database. Just you store the video path in database. You store the videos in a separate folder like video_uploads. After uploading you can call...
1- write PHP fragment code to print out the data submitted by the user through HTML form using get or post method? We need to display the field name and value??
What is the difference between echo and print?
If anyboyd knows, do tell me.Waiting for your prompt response.
1. both are using to display the value.
2. echo is faster than print
3. echo displays multiple statements and variables but print only
4. print is function it returns a value.
echo:- print:- a)can accept multiple parameters. a)cant accept multiple parameters. b)doesnt return any value. b)slower than echo...
Where does the session stored, EIther client side or server side?
The better way is store the sessions server side on database or, if you need high performance loosing scalability, on RAM.
Session values are normally stored on a cookie file.Default cookie file is PHPSESID.This cookie file is stored on a client system.
How do you insert single & double qotes in MySQL db without using PHP?
By using mysql_real_escape_string()...
you can also use
function for convert comma to special chars.Code
Functionality of trim() function
Will the trim() function strip the null bytes?
Yes
By default, yes.
Store session value in cookies
How to store session value in cookies ? Can we store session value in cookie ? If u can please explain how ?
By using setcookie() function...
Would you initialize your strings with single quotes or double quotes?
Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution
Single quote for performance reason, except that there are variables inside.
double quotation
How we know browser properties
Answered by: bicu
View all questions by bicu View all answers by bicu
Member Since Sep-2005 | Answered On : Mar 3rd, 2006
get_browser() attempts to determine the capabilities of the user's browser. This is done by looking up the browser's information in the browscap.ini file.
echo $_SERVER['HTTP_USER_AGENT'] . "<hr />\n";
$browser = get_browser();
foreach ($browser as $name => $value) {
echo "<b>$name</b> $value <br />\n";
}
$_SERVER[HTTP_USER_AGENT]; by this method we can know the properties of browser.
Code
";
How to handle drop down box change event without refreshing page?
You don't need AJAX to perform this action, it can be done without using AJAX by onChange() function.
Try
divId.innerHTML=XMLhttp.responseText
if you want the whole form the whole form has to be posted and urlencoded etc. Just echo back the parts you acctually want with the values you want?
Can you submit a form without using submit button? If yes, how?
yes we can submit without submit button using java script or one more thing is make a location header.. like....
Code
add the following code at your page where you have form named as frmdemo.
function submitForm()
{
document.frmdemo.action=backpage.php;document.frmdemo.submit();
}
</script>
<a href="javascript:submitForm();" >Click here to submit the page
Which will execute faster post or get? Explain
Post execute faster than get method. Get is default super global.
Both Are Types of Super Global Array Both Method is Performing same operation while execution but little difference listed below :: GET :: [1] GET is not Secure for Sensitive Data because Our will...
What is the difference between explode and split?
Split - splits string into array by regular expression.Explode - split a string by stringhope this helps
explode convert string to array. for exmaple.
split take multiple identifier.
explode function is used to convert string into array & split is used to return an array
While in case of download, how will you make a percentage bar showing current status of total 100%?
Yes, this can be done easily by using jQuery
1. Use Image for displaying Percentage Bar.
2. Change width of Image depending on Processing completed.
How to store image in MySQL database via PHP?
"php $iname=$_FILES['img1']['name']; $fp=fopen($_FILES['img1']['tmp_name'],r); $con=fread($fp,filesize($_FILES['img1']['tmp_name'])); mysql_connect("localh...
$iname=$_FILES['img1']['name']; $fp=fopen($_FILES['img1']['tmp_name'],r); $con=fread($fp,filesize($_FILES['img1']['tmp_n...
While working with file system, can feof be used with a file open by fsockopen?
fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will return FALSE.
So feof can be used with a file open by fsockopen
fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets(), fgetss(), fwrite(), fclose(), and feof()). If the call fails, it will return FALSE.
So feof can be used with a file open by fsockopen
For this we can use the session objec($_SESSION)t. When the user login with his/ her user name and password, usually we check those to ensure for correctness. If that user name and password are valid ...
We can use session for that when user logged in with the help of session we can check weather he has logged or not.
Editorial / Best Answer
Answered by: bicu
View all questions by bicu View all answers by bicu
Member Since Sep-2005 | Answered On : Feb 4th, 2006
Difference between require() and require_once(): require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).
So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.
Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.
There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().
require(): displays error and stops the execution.
whereas, include gives a warning and continues the execution.
require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).