Jump to content

[SOLVED] What is better? "space" or "tab"...


web_master

Recommended Posts

Hi,

 

I think this will be a question of experince.

 

Of a time when I begin to write the PHP scripts I do a changes in a style of a writing. Mean at the begin I uses a spaces us a distancer but for now I use the tabs. (not everywhere).

 

<?php

// Reload == 2
if($_REQUEST['reload']<SPACE>==<SPACE>"2") {

// Insert into dBase
$query_return=mysql_query("INSERT INTO `vendegkonyv`<SPACE>(
<TAB>	`vendegkonyv_nev`,
	`vendegkonyv_varos`,
	`vendegkonyv_orszag`,
	`vendegkonyv_txt`,
	`vendegkonyv_datum`
?>

 

Can somebody tell me is some difference in this two writing styles?

 

---------------------------

 

The other thing is maybe a same differences.

 

This is a simple example:

<?php
$query_return = mysql_query("SELECT * FROM `vendegkonyv` WHERE `vendegkonyv_id` = ' " . $_POST['value'] . " ' ");
?>

Up is at end of line: apostrof, quote, dot, POST, dot, quote, apostrof

 

<?php
$query_return = mysql_query("SELECT * FROM `vendegkonyv` WHERE `vendegkonyv_id` = '$_POST['value']'");
?>

Up here is at end of line: apostrof, POST, apostrof.

 

Is some difference or maybe is there some other way of use?

 

thanx

 

T

Link to comment
https://forums.phpfreaks.com/topic/72307-solved-what-is-better-space-or-tab/
Share on other sites

The last question: It's the same thing, but it's better to do the last code cause it's more readable where the variable is colored different. (And you have to validate input to mysql ;))

 

I didn't understand the first one. But

<?php mysql_query("INSERT INTO `table` VALUES('value1', 'value2')"); ?>

and

<?php mysql_query("INSERT INTO `table`
				VALUES('value1', 
				'value2')"); 
?>

is the same thing.

I regularly use tabs, but I do also use spaces when aligning the text sometimes.

I would normally use tabs and spaces in the example i used above:

<?php mysql_query("INSERT INTO `table`
	   VALUES('value1', // Double tabs and three spaces
	   'value2')"); // Double tabs and three spaces
?>

 

But the spaces, breaks and tabs work great around each other  ;)

 

Edit: Just make it most readable by using the possible highlights.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.