MadnessRed Posted February 28, 2009 Share Posted February 28, 2009 Hi, I am sorry if this is in the wrong place but I was wondering, are there any programming languages that are similar to php with the interchangeable data types and and amazing arrays, however are fro standard desktop programming rather than web programming. If there are I would be very interested, I have tried C and C++ but the arrays are nowhere near as god a phps. Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/ Share on other sites More sharing options...
Maq Posted February 28, 2009 Share Posted February 28, 2009 Perl is a good one Google, "loosely typed languages", and try some out, I don't know what you mean by: but the arrays are nowhere near as god a phps. Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773011 Share on other sites More sharing options...
MadnessRed Posted February 28, 2009 Author Share Posted February 28, 2009 Perl is a good one Google, "loosely typed languages", and try some out, I don't know what you mean by: but the arrays are nowhere near as god a phps. I mean with php you can have strange assortments of arrays array( array( int a, array( char b, boolean c ), string d ); and you can call and edit an array value like a normal variable ( array[rel]; ) Also the way you can switch between data types. $var = pow(12,7); $var = "Your anser is: ".$var; where the variable is never defined and can be switched between strings and numbers ect. I will try perl though Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773017 Share on other sites More sharing options...
corbin Posted February 28, 2009 Share Posted February 28, 2009 For an associative array in C++, you can just use a hash map. For an array that is dynamically sized, you can use a vector. for type casting, that's often not even needed. As for an array like you stated as an example.... I can't think of a time when I was coding in C++ that I've ever needed to do that. And, if that was ever required, a1[key] could just point to a2[a1[key]]. Vector example (a hash map example would be almost as easy): (Windows) #include <vector> #include <iostream> #include <stdlib.h> #include <time.h> using namespace std; int main(int argc, char* argv[]) { vector<int> v; srand((unsigned int) time(NULL)); int rn = rand() % 100 + 1; //1-100 random numbers int r = 0; for(int i = 0; i < rn; ++i) { r = rand(); v.push_back(r); cout << "The number was: " << r << endl; } //Now v is a [content-holding] dynamically sized array of ints. } There is a reason that C/C++ are strictly typed by the way. Since they are compiled straight to computer code (for lack of a better term without going into detail), the compiler has to know exactly how much memory each thing will take up, where it will be and so on. As someone else once said (I think it was Daniel0), "It doesn't have the PHP interpreter sitting there holding its hand." (I doubt that's how it was exactly worded.) By the way, I would be willing to argue that Perl is no more a "desktop language" than PHP is. Note that I'm not saying that Perl is strictly a web language. Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773312 Share on other sites More sharing options...
MadnessRed Posted February 28, 2009 Author Share Posted February 28, 2009 so do you compile perl into an application like c++? I am also thinking of looking at C# coz thats quite good apparently? How easy is that to learn? Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773322 Share on other sites More sharing options...
Mark Baker Posted February 28, 2009 Share Posted February 28, 2009 Hi, I am sorry if this is in the wrong place but I was wondering, are there any programming languages that are similar to php with the interchangeable data types and and amazing arrays, however are fro standard desktop programming rather than web programming. If there are I would be very interested, I have tried C and C++ but the arrays are nowhere near as god a phps. You could take a look at PHP-GTK, and there's a couple of PHP compiles for Win32 that I've seen around Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773351 Share on other sites More sharing options...
corbin Posted March 1, 2009 Share Posted March 1, 2009 Perl is interpreted similar to how PHP is. Quote Link to comment https://forums.phpfreaks.com/topic/147253-php-style-computer-coding/#findComment-773663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.