Jump to content

rtconner

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by rtconner

  1. Ok this is for a deployment script I'm writing in PHP. What I'm looking for is a way to load in a given php config file, and modify a variables in it and then write it again. Any ideas how to do this. Thanks Rob
  2. Hey Barand, $bowler_array[$bowler] = $stats; Thats why I did the list, each in my example. Both work though I guess.
  3. If you just want to include something and print its data later, you can do this.. (From the php manual) <?php $foo = include 'return.php'; echo $foo; // prints 'PHP' $bar = include 'noreturn.php'; echo $bar; // prints 1 ?> Otherwise... why can't you just move the include call to be within the body tags?
  4. What does this line of code do? while ($insertionpoint < ($leadstotal+1)){ If you are looping over the $leadid array twice, of course everything is going to get inserted twice.
  5. Uhm.. wow. What you might want to do is rethink the data structure before you even get to smarty. With your current structure I think the only way to do this will loop through scat_names many times for each loop through scats_list. Which ends up being a lot of looping. Try to set it up so you have the following as your data sctructure before even getting into smarty. $scats_list = array( 'cid' => 23 , 'cname' => 'myname' , 'cats_names' => array ('name1', 'name2', 'name3') );
  6. Oh my. So this is cricket. I guess my full lack of knowledge about anything regarding cricket doe not help. Plus you assuming I know something about cricket does not help either. I'll just assume you know why you want random numbers, because I can't even begin to guess why. Maybe try this out. I see why you might have had problems solving this without a good understanding of foreach. No promises on syntax, sorry if I missed a semi colon while (list($key, $bowler) = each($bowler_array)) { // loop through each bowler for ($i = 0; $i < 6; $i++) { // i have no idea why we are looping 6 times inside of each bowler $runs = rand(-1,6); if ($runs == -1) $bowler_array[$key]['wickets']++; // add one to the wicket else $bowler_array[$key]['runs'] += $runs; // runs added to run total? if ($i == 6) $bowler_array[$key]['overs'] += 1; // add one to overs else $bowler_array[$key]['overs'] += 0.1; // add .1 to overs } }
  7. Not really, I've read this 10 times and cannot figure out what you want or want to do. FYI - current($bowler_array[$key]['runs'] and current($bowler_array[$key]['wickets'] are both illegal code because the values in that data is not an array. current() needs an array, not a number passed into it. current($bowler_array[$key]) would be valid code.
  8. Nope, defined values work fine in switch statements. You are doing something else wrong.
  9. Actually, you are close... I think I got it... call_user_func('bar', func_get_args()); might work. I have yet to test this, but in concept it should do the job.
  10. LoL. Not really. In python I could call foo('abc', 5, false, 6, name='joe', type='person', array(1,2,3)); And every single one of those parameters would be passed into bar. Its good for passing parameters to your parent classes constructor and then doing some of your own logic in the constructor also. You don't have to have any idea what the parameters are, you just pass them along (or you can use some of them)
  11. In python (I forget the exact syntax, its been a while) You can write - ... function foo(arg,*args, **kwargs) : bar (arg, *args, **kwargs); ... And all of the variable pass to foo() will then be passed on to bar(). Is there a php equivalent? I've looked around and cannot find anything. I'm thinking something with func_get_args might work, but I can't pinpoint it. Thank.
  12. No it is not possible to do that (if I am understanding the question right) A remote Windows Users computer allowing this to happen would greatly compromise security if it was allowed.
  13. Hey is there any way to call parent::parent::method() parent::method() works fine, but now I need to call a method to the parent classes parent.
×
×
  • 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.