Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   PHP programming (https://www.warriorforum.com/programming/1092378-php-programming.html)

Gaurav singh 17th July 2015 06:07 AM

PHP programming
 
Is PHP a badly designed programming language?

samntly 17th July 2015 04:02 PM

Re: PHP programming
 
That's a very open ended question. The correct question is what do you consider to be features of good programming language vs what do you consider to be features of bad programming language?

Gaurav singh 18th July 2015 12:01 AM

Re: PHP programming
 
Quote:

Originally Posted by samntly (Post 10173877)
That's a very open ended question. The correct question is what do you consider to be features of good programming language vs what do you consider to be features of bad programming language?

Thanks, let me correct my question what are pros and cons of PHP as a programming language ?

unicom 22nd July 2015 05:44 AM

Re: PHP programming
 
Can you be little more clear with your question

kdavies 22nd July 2015 02:28 PM

Re: PHP programming
 
Yes it is, one reason being that is tries to be both a object-oriented language and a functional language. Also function signatures are not consistent. For example you may have a string function where the "haystack" parameter is the first parameter and another string function where the "haystack" parameter is the last parameter.

schnitzelattack 22nd July 2015 02:31 PM

Re: PHP programming
 
One pro for PHP is the constant development of the language. New features are added and there is an upcoming version (5.7 or 7, what ever it will be) that will address performance issues and according to them will run at least 2 times as fast for current code.

ynef 23rd July 2015 02:14 AM

Re: PHP programming
 
I think PHP is beautiful. Especially when written OO style, but I keep hearing more and more about node.js which is a server side javascript language that is supposedly replacing PHP in the future.

kavyaanjali 24th July 2015 10:48 PM

Re: PHP programming
 
hello,
according to me php is just not that bad. using php you can solve any problem related to web site development. its a scripting language. there are many other languages which will help in web development but php is the simplest.

bodsigroup 25th July 2015 02:01 AM

Re: PHP programming
 
Here is the my code. I have created the code but everything is ok... but pagination is not working.


Please Give a solution....

Here is the code:


<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<?php

$page_url = 'managepageuser.php';
$display_per_page = constant("DISPLAYPERPAGE");

if(isset($_GET['pages']) && $_GET['pages']!="1")
{
$pages = $_GET['pages'];
$from_limit = ($pages-1) * $display_per_page;
$to_limit = $from_limit + $display_per_page;
}
else
{
$pages = 1;
$from_limit = 10;
$to_limit = $from_limit + $display_per_page;
}

if($to_limit > $num_lists)
{
$to_limit = $num_lists;
}


if($num_lists > 0)
{
$total_pages = intval($num_lists / $display_per_page);
if($total_pages!='0')
{
if(($num_lists % $display_per_page) !='0') { $total_pages = $total_pages +1; }
}
$prev = $pages - 1;
$next = $pages + 1;
$first = 1;
$last = $total_pages;
$pages_cnt = 1;
if($total_pages > $pages_cnt)
{
$paging_txt .= "<a href='$page_url?pages=$first'>&laquo;&laquo; FIRST</a> | ";
if($pages >1) { $paging_txt .= " <a href='$page_url?pages=$prev'>&laquo;PREVIOUS</a> | "; }
$paging_txt .= "<select name=\"menu1\" onchange=\"MM_jumpMenu('parent',this,0)\">";

while($pages_cnt <= $total_pages)
{
//$paging_txt .= " | <a href='$page_url?pages=$pages_cnt'>".$pages_cnt."</a>";
$paging_txt .= "<option value='".$page_url."?pages=".$pages_cnt."'";
if($pages_cnt == $_GET['pages']) { $paging_txt.= "selected"; }
$paging_txt.= ">".$pages_cnt."</option>";
$pages_cnt++;
}

$paging_txt .= "</select>";

if($pages > 0 && $pages < $total_pages) { $paging_txt .= " | <a href='$page_url?pages=$next'>NEXT&raquo;</a>"; }
if($pages !=$total_pages) { $paging_txt .= " | <a href='$page_url?pages=$last'>LAST &raquo;&raquo;</a>"; }
}
}
?>

<?php
if((isset($_GET['cmd'])) && ($_GET['cmd'] == "status")) {
mysql_query("update $from_limittabledouser set driver_status='".$_GET['status']."' where driver_id='".$_GET['id']."'") or die(mysql_error());
}
if((isset($_GET['cmd'])) && ($_GET['cmd'] == "del")) {
mysql_query("delete from $tabledouser where id='".$_GET['id']."'") or die(mysql_error());
}

/**** FETCH ALL DRIVER RECORDS ***/
if($_SESSION['admintype'] == 'superadmin') {
$sql_list = mysql_query("select * from $tabledouser order by user_name ASC") or die(mysql_error());
$num_list = mysql_num_rows($sql_list);
} else {
$sql_list = mysql_query("select * from $tabledouser order by user_name ASC") or die(mysql_error());
$num_list = mysql_num_rows($sql_list);
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<?php if(isset($_GET['success_msg'])) { ?>
<tr>
<td valign="top" align="center" class="greentxt"><?php echo $_GET['success_msg']; ?></td>
</tr>
<?php } ?>
<?php if($num_list > 0) { ?>
<tr>
<td valign="top" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="rowstbl display" rel="datatable" id="example">
<thead>
<tr>
<th width="6%" align="center" nowrap="nowrap">&nbsp;</th>
<th width="11%" align="center" nowrap="nowrap">ID </th>
<th width="8%" align="center" nowrap="nowrap">User Name </th>
<th width="8%" align="center" nowrap="nowrap">Full Name</th>
<th width="28%" align="center" nowrap="nowrap">Email</th>
<th width="17%" align="center" nowrap="nowrap">Mobile Number </th>
<th width="8%" align="center" nowrap="nowrap">Time Login</th>
<th width="10%" align="center" nowrap="nowrap">Edit</th>
<th align="center">Delete</th>
</tr>
<tbody>
<?php while($res_list = mysql_fetch_array($sql_list)) {
$current_time = date("Y-m-d H:i:s");
$last_current_time = date("Y-m-d H:i:s",mktime(date("H"),date("i")-1,date("s"),date("m"),date("d"),date("Y")));
?>
<tr>
<td align="center"><?php if((isset($_GET['id'])) && ($_GET['id'] == $res_list['id'])) { ?><img src="images/tick.png" /><?php } ?></td>
<td align="center"><?php echo $res_list['id']; ?></td>
<td align="center"><?php echo $res_list['user_name']; ?></td>
<td align="center"><?php echo $res_list['full_name']; ?></td>
<td align="center"><?php echo $res_list['email']; ?></td>
<td align="center"><?php echo $res_list['cntrycode'].'-'.$res_list['mobile']; ?></td>
<td align="center"><?php echo $res_list['create_at']; ?></td>
<td align="center"><a href="javascript:confirmbox_edit(<?php echo $res_list['id']; ?>)"><img src="images/edit.png" width="29" height="29" border="0" /></a></td>
<td align="center"><a href="javascript:confirmbox(<?php echo $res_list['id']; ?>)"><img src="images/delete.png" width="29" height="29" border="0" /></a></td>
</tr>
<?php } ?>
</tbody>
</table></td>
</tr>
<?php } else { ?>
<tr>
<td align="center" class="dtlboxbg tdmargin redtxt"><div align="center">NO RECORD FOUND</div></td>
</tr>
<?php } ?>
</table>

Oprezy 29th July 2015 09:14 AM

Re: PHP programming
 
Quote:

Originally Posted by ynef (Post 10182545)
I think PHP is beautiful. Especially when written OO style, but I keep hearing more and more about node.js which is a server side javascript language that is supposedly replacing PHP in the future.

1. I've got a question, what's OO style?
And,

2. I run a news blog for nigerian students in my country but i want to learn how to code in java and PHP.

Can someone suggest useful resources?

yourfriend78640 29th July 2015 09:22 AM

Re: PHP programming
 
There are mixed opinions about PHP. Is it a badly designed language?
You can say that it is poorly maintained but to answer your above question, you will have to crack a debate here.

Many people say that it creates ugly code and gives you tough time maintaining the code. But most of the time, it is not language's fault. It is developers fault which creates code bloats.

andreajhon 30th July 2015 05:54 AM

Re: PHP programming
 
In my opinion, php is a badly designed programming language. The makers of PHP just wanted to solve a problem. PHP was something that happened and not a well thought out plan as Rasmus Lerdof, its creator says. Other languages, say like python was built for a purpose. Readability, easily deploy a site with little effort. Django, the most popular python framework has a tag line proving the same : "The web framework for perfectionists with deadlines.

Cosmit 31st July 2015 09:48 PM

Re: PHP programming
 
95% of my PHP code is OO. My PHP code looks as clean as Java or C#. If your PHP code looks bad, give up.

techwizard 1st August 2015 08:41 PM

Re: PHP programming
 
I dont think that php is badly designed language as most of the cms system are using php and its working quite well for even programers and end users too

kavyaanjali 22nd September 2015 04:30 AM

Re: PHP programming
 
Any programming language is not bad, every language has their own pros and cons. php stands for hyper text preprocessor. it is open source programming language means php software's and code are freely available on the web and we can modify and enhance the code. no licence is required. php is most suited for web development.

LibertyUnc 22nd September 2015 04:50 PM

Re: PHP programming
 
PHP, like most languages, can be as good or bad as you make it.

Lots of people turn their noses up at PHP because there is so much bad PHP code out there.

Of course, most of those people that I have met don't write the greatest code themselves.

Any good programmer can use most languages and end up with good clean code. Any mediocre programmer can use most languages and end up with something that is bloated and hard to maintain.

I don't believe the language itself is badly designed. I just feel that being a relatively easy language to get started with (no need to learn about compilation, library linking, and other things that many languages need), lots of people new to programming use it with sub par results.

I personally haven't encountered anything that was terribly hard to do with PHP excepting those things that PHP simply cannot do...

bigshot90210 29th September 2015 04:32 PM

Re: PHP programming
 
I love that ebook how to write PHP is 24hrs. However, on Sunday I found a Standford kid who explained how to write in PHP in like 7 minutes. I selected the video and boy, it is excellent. He covered nearly every reserved word, and visually showed how to write form and process the data on the back end, making for the perfect video. To truly grasp what he is saying, you need to have learned a programming language other than php because he explains/defines variables, strings and use of strings and that crazy {} bracket thing and that got me puzzled. I love writing code, but I am not a programmer, but I would like to apply it when necessary. Learn PHP and if you are not information technology, it will take a while. I love solving problems by extending a software program, ie MS Office, outlook, access, DOS or Windows, filezilla, etc.but one thing I have noticed, I can not get paid doing it, cause I suck at it I guess. Maybe? Another thing is because I suck at it, anything I write~ can be rewritten better by someone else, so I settle for what I know and for what I need. Sorry this message is so, so long.

Wiliam Haminton 21st December 2015 04:48 PM

Re: PHP programming
 
I think you is fan ASP . I like PHP !

GeckoTribe 21st December 2015 05:05 PM

Re: PHP programming
 
Sure, PHP has it's blemishes (like argument order inconsistencies mentioned by kdavies). But there's nothing so wrong with it that it's not a perfectly good language for web development.

On the other hand, it has several major strengths, such as:

* It's supported practically everywhere.
* It's drop dead easy to get started using.
* You can stick code inline in HTML code to add little dynamic bits anywhere you want.

If it were a "bad" language, I'd think projects like WordPress would have moved to something else long ago. Are there other languages that are "better"? Depending on what aspects of the language are most important to you, I'm sure there are. But it's a perfectly acceptable alternative.

andrewdennish 4th January 2016 11:13 PM

Re: PHP programming
 
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.

apsarasisodia 4th January 2016 11:33 PM

Re: PHP programming
 
Personal Home Page (PHP) is a very easy programming language. Since it is very flexible, most people may think at first that it is badly designed website development language. Don't listen to those. It is all about perception. Go and learn it at once!


All times are GMT -6. The time now is 12:17 AM.