www.webdeveloper.com
Page 3 of 3 FirstFirst 123
Results 31 to 43 of 43
  1. #31
    Join Date
    Jan 2009
    Posts
    3,343
    Quote Originally Posted by Nils28 View Post
    Yes, I saw that after my first google search.

    But the question here is if did you did try that in netbeans/other IDE (i mean: work with PHP reading/writing without using web browser/server) ?
    I have created a few command line scripts. I've also created a couple OOP projects that had some crossover between strictly for web and command line accessible.

  2. #32
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    190
    First I must apologise for the following post beforehand because I feel like I'm going to be rude, unintentionally, of course.
    Quote Originally Posted by Nils28 View Post
    LOL
    George88,
    Thanks so much for the great post but what I meant by x in HTMLx is the version of HTML like 1.. xhtml.. html5.
    I considered this, but then I Googled and actually found HTMLx. What you mean is XHTML (eXtensible HTML). My last post is still somewhat valid as HTML is a web language too.

    Quote Originally Posted by Nils28 View Post
    Maybe some people would think it's ridiculous to learn programming in PHP without web browser/server. I can understand that but when you intend to lean the fundamentals using this scripting language, you also can configure why it's better to find another way learning these basics without need of GUI.
    Now I'm starting to wonder whether you're a carefully constructed troll, or just don't know much about the world you're delving in to. Don't want to use a GUI? Good grief, go back to the 70s then. You cannot possibly mean you want to refrain from using a GUI, then fire up Netbeans. I've used Netbeans before for Java about 6-7 years ago and I think it counts as an IDE and GUI. If you want to use PHP directly from the command line; again I ask: why?

    I've never used PHP from the command line so I'm not speaking from experience here, but I'd imagine if you want to use the command line, then you'd be accessing applications and code that is not strictly related to the server. In other words you'd be writing PHP that's talking to CGI scripts and back-end applications. Again, might be, and probably am, wrong here.

    Quote Originally Posted by Nils28 View Post
    A friend advised me first to learn these fundamentals in C.
    I told him I do like C only as theoritical instrument following an introduction to computation thinking. And because I want in the future to be junior PHP programmer so it's much better to use this PHP as programming and webprogramming tool.
    So let me get this straight, you don't want to use a server, don't want to use a browser, but you want to learn web programming and you DO want to be a PHP developer?


  3. #33
    Join Date
    Jul 2012
    Posts
    29
    That is totally true.

    Using olny a netbeans-like IDE command line to learn the basics or fundamentals of programming BUT doing this in PHP. Why? Because PHP is the same language I am going to learn for developing webapplications.

    It's handy when you use netbeans command line (output window) to write to screen and to read (if this one also possible) user input. I only need this for learling the fundamentals like variables, how they work, selections, loops, implementing algorithms (e.g search/sort ones), errors, arrays and other datasctructures ..
    It's easier, handy and faster .. starting all the time your browser to check what happens when you switch the content of PHP variable when u assign an integer in one statement and a string in another.. is a kind of boring ..

    After this step, I absolutly have to switch to GUI. :-D

    No .. I didn't mean XHTML with HTMLx because x in HTMLx stands for a version: for example HTML4 HTML5 .. but according to me XHTML is also one of the versions of HTML including XML syntaxis.

    The HTMLx you looked for is also for me something totally new. I didn't know that such a thing exists.

    Kind regards,
    Nils
    Last edited by Nils28; 07-16-2012 at 01:11 PM.

  4. #34
    Join Date
    Jul 2012
    Posts
    29
    Quote Originally Posted by criterion9 View Post
    I have created a few command line scripts. I've also created a couple OOP projects that had some crossover between strictly for web and command line accessible.
    Which IDE did you use for that and is there possibilty to read user-input from its command line (or console)?

    Do you have to include or import any PHP library for doing that?

  5. #35
    Join Date
    Jan 2009
    Posts
    3,343
    Quote Originally Posted by Nils28 View Post
    Which IDE did you use for that and is there possibilty to read user-input from its command line (or console)?

    Do you have to include or import any PHP library for doing that?
    You can code using a plain old text editor if you wish. The built in functions (see the link I posted above) allow for read/write at the command line just the same as any other command line script (sh, bash, bat, etc).

  6. #36
    Join Date
    Jan 2009
    Posts
    3,343
    Quote Originally Posted by Nils28 View Post
    That is totally true.

    Using olny a netbeans-like IDE command line to learn the basics or fundamentals of programming BUT doing this in PHP. Why? Because PHP is the same language I am going to learn for developing webapplications.

    It's handy when you use netbeans command line (output window) to write to screen and to read (if this one also possible) user input. I only need this for learling the fundamentals like variables, how they work, selections, loops, implementing algorithms (e.g search/sort ones), errors, arrays and other datasctructures ..
    It's easier, handy and faster .. starting all the time your browser to check what happens when you switch the content of PHP variable when u assign an integer in one statement and a string in another.. is a kind of boring ..

    After this step, I absolutly have to switch to GUI. :-D

    No .. I didn't mean XHTML with HTMLx because x in HTMLx stands for a version: for example HTML4 HTML5 .. but according to me XHTML is also one of the versions of HTML including XML syntaxis.

    The HTMLx you looked for is also for me something totally new. I didn't know that such a thing exists.

    Kind regards,
    Nils
    PHP is dynamically typed so chances are pretty good that you won't notice much difference in integer versus string (unless you are trying to do math with the values in which case you'll need to cast manually anyway). Using PHP on the command line is very far from the common use for the language so you may in the end find it more difficult to work with in that way (plus finding resources and support will be tricky as well).

  7. #37
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,102
    I even have PHP scripts that can run differently from the command line versus web requests:
    PHP Code:
    <?php
    if(PHP_SAPI == 'cli') {
      
    // stuff particular to the command line interface usage
    }
    else {
      
    // stuff particular to the web interface usage
    }
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  8. #38
    Join Date
    Apr 2012
    Posts
    27
    To learn any language just for basic, go for youtube tutorial, and implement your learn in your work.

  9. #39
    Join Date
    Jul 2012
    Posts
    29

    Cool continue and

    Dears,

    I have here a question about using continue and a string as an array.

    At the end: this was the solution I configured out:
    PHP Code:
    <?php

    printf
    ("Please enter your name: ");

    $name trim(fgets(STDIN));
    $i 0;

    printf("Hello ");
    while (
    $i strlen($name)) {
        while ((
    $i strlen($name)) && ($name[$i] == '.')) { // if I switch the position of operands? Uninitialized string offset error
            
    $i++;
        }

        if (
    $i strlen($name)) { // if remove this? Uninitialized string offset error
            
    printf("%s"$name[$i]);
        }
        
    $i++;
    }

    printf("%s""!\n");

    exit(
    1);
    ?>
    The purpose of this little program is to take an input, remove all dots if there are any and finally print the name clean.


    continue;
    My first attempts didn't give the result I wanted, so I get two errors.
    The continue just blocks my program and ends in a loop.

    PHP Code:
    printf("Please enter your name: ");

    $name trim(fgets(STDIN));
    $i 0;

    printf("Hello ");

    while (
    $i strlen($name)) {
        while (
    $name[$i] == '.') {
            continue;
        }

        
    printf("%s"$name[$i]);
        
    $i++;
    }

    printf("%s""!\n");

    exit(
    1); 
    Output:
    Code:
    Please enter your name: ni..ls
    Hello ni
    And program does not exit.

    So, I decided to replace continue; by $i++; and so it works.

    BUT if the input ends with dot(s), then I get error.

    Output:
    Code:
    Please enter your name: ni..ls.
    PHP Notice:  Uninitialized string offset:  7 in path on line 30
    PHP Notice:  Uninitialized string offset:  7 in path on line 34
    Hello nils
    Notice: Uninitialized string offset:  7 in path on line 30
    
    Notice: Uninitialized string offset:  7 in path on line 34
    !
    I finally solved it and I understand why the error but the while is already there evaluating the input?

    Thanks.

    Kr,
    Nils
    Last edited by Nils28; 07-17-2012 at 02:10 PM.

  10. #40
    Join Date
    Sep 2008
    Location
    Sarasota, Florida
    Posts
    96
    How about a good class in programming at a local university? YOU KNOW, LIKE SCHOOL?

  11. #41
    Join Date
    Jul 2012
    Posts
    29
    Quote Originally Posted by ixora View Post
    How about a good class in programming at a local university? YOU KNOW, LIKE SCHOOL?
    I have to work and I don't like evening classes.

    At the moment, I have another problem.

    I learned some basics in PHP and it seems I don't like it as there's no logic behind but only conventions.

    Ruby or PHP?

    In PHP you can change the content of a variable and there's no possibility to determine it. You can do $v1 = 1; and after that you can use it for a string of even an array !!

    This doesn't exist in Ruby, though there's something totally crazy you can do with Ruby like print "1" * 10.


    Advice me pls ..

  12. #42
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    190
    Nils,

    If you're confused about which language is the best one to learn for you, perhaps the more pertinent question you should ask yourself is why do you want to learn programming in the first place? Each language you learn will have certain tasks which is excels in. For example, PHP is the language of choice for server-side programming. On the other hand, PHP would be a poor choice of language for general-purpose programs when languages such as C/C++ and even Java exist. You wouldn't use PHP for Win32 programming or writing a game.

    By the same token, Ruby is a general purpose programming language and is not specific to the web or even best suited to it. If you want to use Ruby on Rails, then that's a Ruby framework for use on the web, but I don't know anything about Ruby so I won't advise you on that language.

    Regarding your concerns about your variables not being declared with any specific type; that's simply because PHP is a loosly typed (or weakly typed) language. It has no set data types like some other languages (int, char, float, etc).

    In PHP, if you declare an int like this:

    PHP Code:
    $integer_var 1
    And then decide you want to convert that variable to a string, it simply becomes a string. For example:

    PHP Code:
    // Declare int/
    $integer_var 1;

    // Convert it to a string.
    $integer_var "1"
    In PHP this is known as "type juggling". The php.net explanation says:

    Quote Originally Posted by php.net
    PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then assigned to $var, it becomes an integer.
    You may like to read the full article, it should help you understand how data types work in PHP: http://www.php.net/manual/en/languag...e-juggling.php

  13. #43
    Join Date
    Mar 2013
    Posts
    1

    PHP development

    There are tons of articles and posts available on internet for how to start with php. I suggest you should have the knowledge of working in basic html for starting with this. Besides learning php development is not so hard so you will easily be able to be a good php developer if you do a nice survey and have good grasping power.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles