sub routines in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dangre
Forum Newbie
Posts: 9
Joined: Fri Jan 13, 2006 5:50 pm

sub routines in php

Post by dangre »

Greetings board members!

I'm new to php and this message board, and do some programming in asp. In asp you can call a sub-routine during some user event. For example:

<%
Sub UserDoesSomething
response.redirect "mypage.asp"
End Sub
%>

<%
If x = 1 Then
Call UserDoesSomething
Else
End If
%>


I was wondering what the php equivalent is to writing and calling a sub like the example above?

Thanks much for the post backs!
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

functions :)

Code: Select all

<?php
function UserDoesSomething ()
{
    header('Location: http://www.mydomain.com/mypage.php');
}

if ($x == 1) {
    UserDoesSomething();
}
?>
dangre
Forum Newbie
Posts: 9
Joined: Fri Jan 13, 2006 5:50 pm

Post by dangre »

Fantastic, just what I was looking for. Thanks a million! :D
Post Reply